npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

@xylabs/logger

v5.0.90

Published

XYLabs Logger Library

Readme

@xylabs/logger

logo

main-build npm-badge npm-downloads-badge jsdelivr-badge npm-license-badge codacy-badge codeclimate-badge snyk-badge socket-badge

XYLabs Logger Library

Reference

@xylabs/logger


Classes

| Class | Description | | ------ | ------ | | ConsoleLogger | A LevelLogger that delegates to the global console object. | | IdLogger | A logger wrapper that prefixes every log message with a bracketed identifier. Useful for distinguishing log output from different components or instances. | | 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 | 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. |

Interfaces

| Interface | Description | | ------ | ------ | | Logger | Interface to handle overlap between Winston & console with as much congruency as possible. |

Type Aliases

| Type Alias | Description | | ------ | ------ | | LogFunction | A generic logging function that accepts any number of arguments. | | LogLevelKey | String key for a log level (e.g. 'error', 'warn', 'info'). | | LogVerbosity | Alias for LogLevelKey, representing the verbosity setting as a string. | | LogLevelValue | Numeric value of a log level (1 through 6). |

Variables

| Variable | Description | | ------ | ------ | | LogLevel | Numeric log level values, from least verbose (error=1) to most verbose (trace=6). |

Functions

| Function | Description | | ------ | ------ | | NoOpLogFunction | A log function that silently discards all arguments. | | getFunctionName | Retrieves the name of the calling function by inspecting the stack trace. |

classes

ConsoleLogger

@xylabs/logger


A LevelLogger that delegates to the global console object.

Extends

Constructors

Constructor

new ConsoleLogger(level?: LogLevelValue): ConsoleLogger;

Parameters

| Parameter | Type | Default value | | ------ | ------ | ------ | | level | LogLevelValue | LogLevel.warn |

Returns

ConsoleLogger

Overrides

LevelLogger.constructor

Properties

| Property | Modifier | Type | Inherited from | | ------ | ------ | ------ | ------ | | level | readonly | LogLevelValue | LevelLogger.level | | logger | readonly | Logger | LevelLogger.logger |

Accessors

debug

Get Signature

get debug(): LogFunction;

Returns

LogFunction

Inherited from

LevelLogger.debug


error

Get Signature

get error(): LogFunction;

Returns

LogFunction

Inherited from

LevelLogger.error


info

Get Signature

get info(): LogFunction;

Returns

LogFunction

Inherited from

LevelLogger.info


log

Get Signature

get log(): LogFunction;

Returns

LogFunction

Inherited from

LevelLogger.log


trace

Get Signature

get trace(): LogFunction;

Returns

LogFunction

Inherited from

LevelLogger.trace


warn

Get Signature

get warn(): LogFunction;

Returns

LogFunction

Inherited from

LevelLogger.warn

IdLogger

@xylabs/logger


A logger wrapper that prefixes every log message with a bracketed identifier. Useful for distinguishing log output from different components or instances.

Implements

Constructors

Constructor

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

Parameters

| Parameter | Type | | ------ | ------ | | logger | Logger | | id? | () => string |

Returns

IdLogger

Accessors

id

Set Signature

set id(id: string): void;

Parameters

| Parameter | Type | | ------ | ------ | | id | string |

Returns

void

Methods

debug()

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

Parameters

| Parameter | Type | | ------ | ------ | | ...data | unknown[] |

Returns

void

Implementation of

Logger.debug

error()

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

Parameters

| Parameter | Type | | ------ | ------ | | ...data | unknown[] |

Returns

void

Implementation of

Logger.error

info()

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

Parameters

| Parameter | Type | | ------ | ------ | | ...data | unknown[] |

Returns

void

Implementation of

Logger.info

log()

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

Parameters

| Parameter | Type | | ------ | ------ | | ...data | unknown[] |

Returns

void

Implementation of

Logger.log

trace()

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

Parameters

| Parameter | Type | | ------ | ------ | | ...data | unknown[] |

Returns

void

Implementation of

Logger.trace

warn()

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

Parameters

| Parameter | Type | | ------ | ------ | | ...data | unknown[] |

Returns

void

Implementation of

Logger.warn

LevelLogger

@xylabs/logger


A logger that filters messages based on a configured log level. Methods for levels above the configured threshold return a no-op function.

Extended by

Implements

Constructors

Constructor

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

Parameters

| Parameter | Type | Default value | | ------ | ------ | ------ | | logger | Logger | undefined | | level | LogLevelValue | LogLevel.warn |

Returns

LevelLogger

Properties

| Property | Modifier | Type | | ------ | ------ | ------ | | level | readonly | LogLevelValue | | logger | readonly | Logger |

Accessors

debug

Get Signature

get debug(): LogFunction;

Returns

LogFunction

Implementation of

Logger.debug


error

Get Signature

get error(): LogFunction;

Returns

LogFunction

Implementation of

Logger.error


info

Get Signature

get info(): LogFunction;

Returns

LogFunction

Implementation of

Logger.info


log

Get Signature

get log(): LogFunction;

Returns

LogFunction

Implementation of

Logger.log


trace

Get Signature

get trace(): LogFunction;

Returns

LogFunction

Implementation of

Logger.trace


warn

Get Signature

get warn(): LogFunction;

Returns

LogFunction

Implementation of

Logger.warn

SilentLogger

@xylabs/logger


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.

Implements

Constructors

Constructor

new SilentLogger(): SilentLogger;

Returns

SilentLogger

Properties

| Property | Modifier | Type | Default value | | ------ | ------ | ------ | ------ | | debug | readonly | (..._data: unknown[]) => undefined | NoOpLogFunction | | error | readonly | (..._data: unknown[]) => undefined | NoOpLogFunction | | info | readonly | (..._data: unknown[]) => undefined | NoOpLogFunction | | log | readonly | (..._data: unknown[]) => undefined | NoOpLogFunction | | trace | readonly | (..._data: unknown[]) => undefined | NoOpLogFunction | | warn | readonly | (..._data: unknown[]) => undefined | NoOpLogFunction |

functions

NoOpLogFunction

@xylabs/logger


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

A log function that silently discards all arguments.

Parameters

| Parameter | Type | | ------ | ------ | | ..._data | unknown[] |

Returns

undefined

getFunctionName

@xylabs/logger


function getFunctionName(depth?: number): string;

Retrieves the name of the calling function by inspecting the stack trace.

Parameters

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

Returns

string

The function name, or '' if it cannot be determined.

interfaces

Logger

@xylabs/logger


Interface to handle overlap between Winston & console with as much congruency as possible.

Properties

| Property | Type | | ------ | ------ | | debug | LogFunction | | error | LogFunction | | info | LogFunction | | log | LogFunction | | trace | LogFunction | | warn | LogFunction |

type-aliases

LogFunction

@xylabs/logger


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

A generic logging function that accepts any number of arguments.

Parameters

| Parameter | Type | | ------ | ------ | | ...data | unknown[] |

Returns

void

LogLevelKey

@xylabs/logger


type LogLevelKey = EnumKey<typeof LogLevel>;

String key for a log level (e.g. 'error', 'warn', 'info').

LogLevelValue

@xylabs/logger


type LogLevelValue = EnumValue<typeof LogLevel>;

Numeric value of a log level (1 through 6).

LogVerbosity

@xylabs/logger


type LogVerbosity = LogLevelKey;

Alias for LogLevelKey, representing the verbosity setting as a string.

variables

LogLevel

@xylabs/logger


const LogLevel: Enum<{
  error: 1;
  warn: 2;
  info: 3;
  log: 4;
  debug: 5;
  trace: 6;
}>;

Numeric log level values, from least verbose (error=1) to most verbose (trace=6).

Part of sdk-js

Maintainers

License

See the LICENSE file for license details

Credits

Made with 🔥 and ❄️ by XYLabs