🚀 Socket Launch Week Day 5:Introducing Repository Access Permissions and Custom Roles.Learn more
Sign In

@xylabs/logger

Package Overview
Dependencies
Maintainers
5
Versions
454
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@xylabs/logger - npm Package Compare versions

Comparing version
5.0.95
to
5.0.96
+9
-12
package.json
{
"name": "@xylabs/logger",
"version": "5.0.95",
"version": "5.0.96",
"description": "XYLabs Logger Library",

@@ -32,3 +32,2 @@ "keywords": [

"types": "./dist/neutral/index.d.ts",
"import": "./dist/neutral/index.mjs",
"default": "./dist/neutral/index.mjs"

@@ -38,3 +37,2 @@ },

},
"types": "./dist/neutral/index.d.ts",
"files": [

@@ -48,15 +46,14 @@ "dist",

"dependencies": {
"@xylabs/enum": "~5.0.95",
"@xylabs/error": "~5.0.95",
"@xylabs/typeof": "~5.0.95"
"@xylabs/enum": "~5.0.96",
"@xylabs/error": "~5.0.96",
"@xylabs/typeof": "~5.0.96"
},
"devDependencies": {
"@types/node": "~25.5.2",
"@xylabs/ts-scripts-common": "~7.8.4",
"@xylabs/ts-scripts-pnpm": "~7.8.4",
"@xylabs/tsconfig": "~7.8.4",
"@types/node": "~25.6.0",
"@xylabs/toolchain": "~7.10.4",
"@xylabs/tsconfig": "~7.10.4",
"esbuild": "^0.28.0",
"typescript": "^5",
"vite": "^8.0.5",
"vitest": "^4.1.2"
"vite": "^8.0.8",
"vitest": "^4.1.4"
},

@@ -63,0 +60,0 @@ "engines": {

+327
-173
# @xylabs/logger
[![logo][]](https://xylabs.com)
[![npm][npm-badge]][npm-link]
[![license][license-badge]][license-link]
[![main-build][]][main-build-link]
[![npm-badge][]][npm-link]
[![npm-downloads-badge][]][npm-link]
[![jsdelivr-badge][]][jsdelivr-link]
[![npm-license-badge][]](LICENSE)
[![codacy-badge][]][codacy-link]
[![codeclimate-badge][]][codeclimate-link]
[![snyk-badge][]][snyk-link]
[![socket-badge][]][socket-link]
> XYLabs Logger Library
## Install
XYLabs Logger Library
Using npm:
```sh
npm install {{name}}
```
Using yarn:
## Reference
```sh
yarn add {{name}}
```
**@xylabs/logger**
Using pnpm:
***
```sh
pnpm add {{name}}
```
## Classes
Using bun:
| Class | Description |
| ------ | ------ |
| [ConsoleLogger](#classes/ConsoleLogger) | A LevelLogger that delegates to the global `console` object. |
| [IdLogger](#classes/IdLogger) | A logger wrapper that prefixes every log message with a bracketed identifier. Useful for distinguishing log output from different components or instances. |
| [LevelLogger](#classes/LevelLogger) | A logger that filters messages based on a configured log level. Methods for levels above the configured threshold return a no-op function. |
| [SilentLogger](#classes/SilentLogger) | A logger that does not log anything. This is useful when you want to disable logging like when running unit tests or in silent mode. It implements the `Logger` interface but all methods are no-op functions. |
```sh
bun add {{name}}
```
## Interfaces
| Interface | Description |
| ------ | ------ |
| [Logger](#interfaces/Logger) | Interface to handle overlap between Winston & `console` with as much congruency as possible. |
## License
## Type Aliases
See the [LICENSE](LICENSE) file for license rights and limitations (LGPL-3.0-only).
| Type Alias | Description |
| ------ | ------ |
| [LogFunction](#type-aliases/LogFunction) | A generic logging function that accepts any number of arguments. |
| [LogLevelKey](#type-aliases/LogLevelKey) | String key for a log level (e.g. 'error', 'warn', 'info'). |
| [LogVerbosity](#type-aliases/LogVerbosity) | Alias for LogLevelKey, representing the verbosity setting as a string. |
| [LogLevelValue](#type-aliases/LogLevelValue) | Numeric value of a log level (1 through 6). |
## Reference
## Variables
### packages
| Variable | Description |
| ------ | ------ |
| [LogLevel](#variables/LogLevel) | Numeric log level values, from least verbose (error=1) to most verbose (trace=6). |
### logger
## Functions
### .temp-typedoc
| Function | Description |
| ------ | ------ |
| [NoOpLogFunction](#functions/NoOpLogFunction) | A log function that silently discards all arguments. |
| [getFunctionName](#functions/getFunctionName) | Retrieves the name of the calling function by inspecting the stack trace. |
### classes
### classes
### <a id="ConsoleLogger"></a>ConsoleLogger
### <a id="ConsoleLogger"></a>ConsoleLogger
[**@xylabs/logger**](#../README)

@@ -82,3 +66,3 @@

```ts
new ConsoleLogger(level?: LogLevelValue): ConsoleLogger;
new ConsoleLogger(level?): ConsoleLogger;
```

@@ -88,6 +72,6 @@

| Parameter | Type | Default value |
| ------ | ------ | ------ |
| `level` | [`LogLevelValue`](#../type-aliases/LogLevelValue) | `LogLevel.warn` |
#### level?
[`LogLevelValue`](#../type-aliases/LogLevelValue) = `LogLevel.warn`
### Returns

@@ -103,7 +87,24 @@

| Property | Modifier | Type | Inherited from |
| ------ | ------ | ------ | ------ |
| <a id="level"></a> `level` | `readonly` | [`LogLevelValue`](#../type-aliases/LogLevelValue) | [`LevelLogger`](#LevelLogger).[`level`](LevelLogger.md#level) |
| <a id="logger"></a> `logger` | `readonly` | [`Logger`](#../interfaces/Logger) | [`LevelLogger`](#LevelLogger).[`logger`](LevelLogger.md#logger) |
### level
```ts
readonly level: LogLevelValue;
```
### Inherited from
[`LevelLogger`](#LevelLogger).[`level`](LevelLogger.md#level)
***
### logger
```ts
readonly logger: Logger;
```
### Inherited from
[`LevelLogger`](#LevelLogger).[`logger`](LevelLogger.md#logger)
## Accessors

@@ -217,3 +218,3 @@

### <a id="IdLogger"></a>IdLogger
### <a id="IdLogger"></a>IdLogger

@@ -236,3 +237,3 @@ [**@xylabs/logger**](#../README)

```ts
new IdLogger(logger: Logger, id?: () => string): IdLogger;
new IdLogger(logger, id?): IdLogger;
```

@@ -242,7 +243,10 @@

| Parameter | Type |
| ------ | ------ |
| `logger` | [`Logger`](#../interfaces/Logger) |
| `id?` | () => `string` |
#### logger
[`Logger`](#../interfaces/Logger)
#### id?
() => `string`
### Returns

@@ -259,3 +263,3 @@

```ts
set id(id: string): void;
set id(id): void;
```

@@ -265,6 +269,6 @@

| Parameter | Type |
| ------ | ------ |
| `id` | `string` |
##### id
`string`
#### Returns

@@ -279,3 +283,3 @@

```ts
debug(...data: unknown[]): void;
debug(...data): void;
```

@@ -285,6 +289,6 @@

| Parameter | Type |
| ------ | ------ |
| ...`data` | `unknown`[] |
#### data
...`unknown`[]
### Returns

@@ -305,3 +309,3 @@

```ts
error(...data: unknown[]): void;
error(...data): void;
```

@@ -311,6 +315,6 @@

| Parameter | Type |
| ------ | ------ |
| ...`data` | `unknown`[] |
#### data
...`unknown`[]
### Returns

@@ -331,3 +335,3 @@

```ts
info(...data: unknown[]): void;
info(...data): void;
```

@@ -337,6 +341,6 @@

| Parameter | Type |
| ------ | ------ |
| ...`data` | `unknown`[] |
#### data
...`unknown`[]
### Returns

@@ -357,3 +361,3 @@

```ts
log(...data: unknown[]): void;
log(...data): void;
```

@@ -363,6 +367,6 @@

| Parameter | Type |
| ------ | ------ |
| ...`data` | `unknown`[] |
#### data
...`unknown`[]
### Returns

@@ -383,3 +387,3 @@

```ts
trace(...data: unknown[]): void;
trace(...data): void;
```

@@ -389,6 +393,6 @@

| Parameter | Type |
| ------ | ------ |
| ...`data` | `unknown`[] |
#### data
...`unknown`[]
### Returns

@@ -409,3 +413,3 @@

```ts
warn(...data: unknown[]): void;
warn(...data): void;
```

@@ -415,6 +419,6 @@

| Parameter | Type |
| ------ | ------ |
| ...`data` | `unknown`[] |
#### data
...`unknown`[]
### Returns

@@ -430,3 +434,3 @@

### <a id="LevelLogger"></a>LevelLogger
### <a id="LevelLogger"></a>LevelLogger

@@ -453,3 +457,3 @@ [**@xylabs/logger**](#../README)

```ts
new LevelLogger(logger: Logger, level?: LogLevelValue): LevelLogger;
new LevelLogger(logger, level?): LevelLogger;
```

@@ -459,7 +463,10 @@

| Parameter | Type | Default value |
| ------ | ------ | ------ |
| `logger` | [`Logger`](#../interfaces/Logger) | `undefined` |
| `level` | [`LogLevelValue`](#../type-aliases/LogLevelValue) | `LogLevel.warn` |
#### logger
[`Logger`](#../interfaces/Logger)
#### level?
[`LogLevelValue`](#../type-aliases/LogLevelValue) = `LogLevel.warn`
### Returns

@@ -471,7 +478,16 @@

| Property | Modifier | Type |
| ------ | ------ | ------ |
| <a id="level"></a> `level` | `readonly` | [`LogLevelValue`](#../type-aliases/LogLevelValue) |
| <a id="logger"></a> `logger` | `readonly` | [`Logger`](#../interfaces/Logger) |
### level
```ts
readonly level: LogLevelValue;
```
***
### logger
```ts
readonly logger: Logger;
```
## Accessors

@@ -585,3 +601,3 @@

### <a id="SilentLogger"></a>SilentLogger
### <a id="SilentLogger"></a>SilentLogger

@@ -616,15 +632,148 @@ [**@xylabs/logger**](#../README)

| Property | Modifier | Type | Default value |
| ------ | ------ | ------ | ------ |
| <a id="debug"></a> `debug` | `readonly` | (...`_data`: `unknown`[]) => `undefined` | `NoOpLogFunction` |
| <a id="error"></a> `error` | `readonly` | (...`_data`: `unknown`[]) => `undefined` | `NoOpLogFunction` |
| <a id="info"></a> `info` | `readonly` | (...`_data`: `unknown`[]) => `undefined` | `NoOpLogFunction` |
| <a id="log"></a> `log` | `readonly` | (...`_data`: `unknown`[]) => `undefined` | `NoOpLogFunction` |
| <a id="trace"></a> `trace` | `readonly` | (...`_data`: `unknown`[]) => `undefined` | `NoOpLogFunction` |
| <a id="warn"></a> `warn` | `readonly` | (...`_data`: `unknown`[]) => `undefined` | `NoOpLogFunction` |
### debug
### functions
```ts
readonly debug: (..._data) => undefined = NoOpLogFunction;
```
### <a id="NoOpLogFunction"></a>NoOpLogFunction
A log function that silently discards all arguments.
### Parameters
#### \_data
...`unknown`[]
### Returns
`undefined`
### Implementation of
[`Logger`](#../interfaces/Logger).[`debug`](../interfaces/Logger.md#debug)
***
### error
```ts
readonly error: (..._data) => undefined = NoOpLogFunction;
```
A log function that silently discards all arguments.
### Parameters
#### \_data
...`unknown`[]
### Returns
`undefined`
### Implementation of
[`Logger`](#../interfaces/Logger).[`error`](../interfaces/Logger.md#error)
***
### info
```ts
readonly info: (..._data) => undefined = NoOpLogFunction;
```
A log function that silently discards all arguments.
### Parameters
#### \_data
...`unknown`[]
### Returns
`undefined`
### Implementation of
[`Logger`](#../interfaces/Logger).[`info`](../interfaces/Logger.md#info)
***
### log
```ts
readonly log: (..._data) => undefined = NoOpLogFunction;
```
A log function that silently discards all arguments.
### Parameters
#### \_data
...`unknown`[]
### Returns
`undefined`
### Implementation of
[`Logger`](#../interfaces/Logger).[`log`](../interfaces/Logger.md#log)
***
### trace
```ts
readonly trace: (..._data) => undefined = NoOpLogFunction;
```
A log function that silently discards all arguments.
### Parameters
#### \_data
...`unknown`[]
### Returns
`undefined`
### Implementation of
[`Logger`](#../interfaces/Logger).[`trace`](../interfaces/Logger.md#trace)
***
### warn
```ts
readonly warn: (..._data) => undefined = NoOpLogFunction;
```
A log function that silently discards all arguments.
### Parameters
#### \_data
...`unknown`[]
### Returns
`undefined`
### Implementation of
[`Logger`](#../interfaces/Logger).[`warn`](../interfaces/Logger.md#warn)
### functions
### <a id="NoOpLogFunction"></a>NoOpLogFunction
[**@xylabs/logger**](#../README)

@@ -635,3 +784,3 @@

```ts
function NoOpLogFunction(..._data: unknown[]): undefined;
function NoOpLogFunction(..._data): undefined;
```

@@ -643,6 +792,6 @@

| Parameter | Type |
| ------ | ------ |
| ...`_data` | `unknown`[] |
### \_data
...`unknown`[]
## Returns

@@ -652,3 +801,3 @@

### <a id="getFunctionName"></a>getFunctionName
### <a id="getFunctionName"></a>getFunctionName

@@ -660,3 +809,3 @@ [**@xylabs/logger**](#../README)

```ts
function getFunctionName(depth?: number): string;
function getFunctionName(depth?): string;
```

@@ -668,6 +817,8 @@

| Parameter | Type | Default value | Description |
| ------ | ------ | ------ | ------ |
| `depth` | `number` | `2` | The stack frame depth to inspect (default: 2, the caller's caller). |
### depth?
`number` = `2`
The stack frame depth to inspect (default: 2, the caller's caller).
## Returns

@@ -679,5 +830,5 @@

### interfaces
### interfaces
### <a id="Logger"></a>Logger
### <a id="Logger"></a>Logger

@@ -693,15 +844,52 @@ [**@xylabs/logger**](#../README)

| Property | Type |
| ------ | ------ |
| <a id="debug"></a> `debug` | [`LogFunction`](#../type-aliases/LogFunction) |
| <a id="error"></a> `error` | [`LogFunction`](#../type-aliases/LogFunction) |
| <a id="info"></a> `info` | [`LogFunction`](#../type-aliases/LogFunction) |
| <a id="log"></a> `log` | [`LogFunction`](#../type-aliases/LogFunction) |
| <a id="trace"></a> `trace` | [`LogFunction`](#../type-aliases/LogFunction) |
| <a id="warn"></a> `warn` | [`LogFunction`](#../type-aliases/LogFunction) |
### debug
### type-aliases
```ts
debug: LogFunction;
```
### <a id="LogFunction"></a>LogFunction
***
### error
```ts
error: LogFunction;
```
***
### info
```ts
info: LogFunction;
```
***
### log
```ts
log: LogFunction;
```
***
### trace
```ts
trace: LogFunction;
```
***
### warn
```ts
warn: LogFunction;
```
### type-aliases
### <a id="LogFunction"></a>LogFunction
[**@xylabs/logger**](#../README)

@@ -712,3 +900,3 @@

```ts
type LogFunction = (...data: unknown[]) => void;
type LogFunction = (...data) => void;
```

@@ -720,6 +908,6 @@

| Parameter | Type |
| ------ | ------ |
| ...`data` | `unknown`[] |
### data
...`unknown`[]
## Returns

@@ -729,3 +917,3 @@

### <a id="LogLevelKey"></a>LogLevelKey
### <a id="LogLevelKey"></a>LogLevelKey

@@ -742,3 +930,3 @@ [**@xylabs/logger**](#../README)

### <a id="LogLevelValue"></a>LogLevelValue
### <a id="LogLevelValue"></a>LogLevelValue

@@ -755,3 +943,3 @@ [**@xylabs/logger**](#../README)

### <a id="LogVerbosity"></a>LogVerbosity
### <a id="LogVerbosity"></a>LogVerbosity

@@ -768,5 +956,5 @@ [**@xylabs/logger**](#../README)

### variables
### variables
### <a id="LogLevel"></a>LogLevel
### <a id="LogLevel"></a>LogLevel

@@ -791,39 +979,5 @@ [**@xylabs/logger**](#../README)

Part of [sdk-js](https://www.npmjs.com/package/@xyo-network/sdk-js)
## Maintainers
- [Arie Trouw](https://github.com/arietrouw) ([arietrouw.com](https://arietrouw.com))
- [Matt Jones](https://github.com/jonesmac)
- [Joel Carter](https://github.com/JoelBCarter)
- [Jordan Trouw](https://github.com/jordantrouw)
## License
> See the [LICENSE](LICENSE) file for license details
## Credits
[Made with 🔥 and ❄️ by XYLabs](https://xylabs.com)
[logo]: https://cdn.xy.company/img/brand/XYPersistentCompany_Logo_Icon_Colored.svg
[main-build]: https://github.com/xylabs/sdk-js/actions/workflows/build.yml/badge.svg
[main-build-link]: https://github.com/xylabs/sdk-js/actions/workflows/build.yml
[npm-badge]: https://img.shields.io/npm/v/@xylabs/logger.svg
[npm-link]: https://www.npmjs.com/package/@xylabs/logger
[codacy-badge]: https://app.codacy.com/project/badge/Grade/c8e15e14f37741c18cfb47ac7245c698
[codacy-link]: https://www.codacy.com/gh/xylabs/sdk-js/dashboard?utm_source=github.com&utm_medium=referral&utm_content=xylabs/sdk-js&utm_campaign=Badge_Grade
[codeclimate-badge]: https://api.codeclimate.com/v1/badges/c5eb068f806f0b047ea7/maintainability
[codeclimate-link]: https://codeclimate.com/github/xylabs/sdk-js/maintainability
[snyk-badge]: https://snyk.io/test/github/xylabs/sdk-js/badge.svg?targetFile=package.json
[snyk-link]: https://snyk.io/test/github/xylabs/sdk-js?targetFile=package.json
[npm-downloads-badge]: https://img.shields.io/npm/dw/@xylabs/logger
[npm-license-badge]: https://img.shields.io/npm/l/@xylabs/logger
[jsdelivr-badge]: https://data.jsdelivr.com/v1/package/npm/@xylabs/logger/badge
[jsdelivr-link]: https://www.jsdelivr.com/package/npm/@xylabs/logger
[socket-badge]: https://socket.dev/api/badge/npm/package/@xylabs/logger
[socket-link]: https://socket.dev/npm/package/@xylabs/logger
[license-badge]: https://img.shields.io/npm/l/@xylabs/logger.svg
[license-link]: https://github.com/xylabs/sdk-js/blob/main/LICENSE