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.97

Published

XYLabs Logger Library

Readme

@xylabs/logger

npm license

XYLabs Logger Library

Install

Using npm:

npm install {{name}}

Using yarn:

yarn add {{name}}

Using pnpm:

pnpm add {{name}}

Using bun:

bun add {{name}}

License

See the LICENSE file for license rights and limitations (LGPL-3.0-only).

Reference

packages

logger

### .temp-typedoc

  ### classes

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

@xylabs/logger


A LevelLogger that delegates to the global console object.

Extends

Constructors

Constructor

new ConsoleLogger(level?): ConsoleLogger;

Parameters

level?

LogLevelValue = LogLevel.warn

Returns

ConsoleLogger

Overrides

LevelLogger.constructor

Properties

level

readonly level: LogLevelValue;

Inherited from

LevelLogger.level


logger

readonly logger: Logger;

Inherited from

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

    ### <a id="IdLogger"></a>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, id?): IdLogger;

Parameters

logger

Logger

id?

() => string

Returns

IdLogger

Accessors

id

Set Signature

set id(id): void;

Parameters

id

string

Returns

void

Methods

debug()

debug(...data): void;

Parameters

data

...unknown[]

Returns

void

Implementation of

Logger.debug

error()

error(...data): void;

Parameters

data

...unknown[]

Returns

void

Implementation of

Logger.error

info()

info(...data): void;

Parameters

data

...unknown[]

Returns

void

Implementation of

Logger.info

log()

log(...data): void;

Parameters

data

...unknown[]

Returns

void

Implementation of

Logger.log

trace()

trace(...data): void;

Parameters

data

...unknown[]

Returns

void

Implementation of

Logger.trace

warn()

warn(...data): void;

Parameters

data

...unknown[]

Returns

void

Implementation of

Logger.warn
    ### <a id="LevelLogger"></a>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, level?): LevelLogger;

Parameters

logger

Logger

level?

LogLevelValue = LogLevel.warn

Returns

LevelLogger

Properties

level

readonly level: LogLevelValue;

logger

readonly logger: 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

    ### <a id="SilentLogger"></a>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

debug

readonly debug: (..._data) => undefined = NoOpLogFunction;

A log function that silently discards all arguments.

Parameters

_data

...unknown[]

Returns

undefined

Implementation of

Logger.debug


error

readonly error: (..._data) => undefined = NoOpLogFunction;

A log function that silently discards all arguments.

Parameters

_data

...unknown[]

Returns

undefined

Implementation of

Logger.error


info

readonly info: (..._data) => undefined = NoOpLogFunction;

A log function that silently discards all arguments.

Parameters

_data

...unknown[]

Returns

undefined

Implementation of

Logger.info


log

readonly log: (..._data) => undefined = NoOpLogFunction;

A log function that silently discards all arguments.

Parameters

_data

...unknown[]

Returns

undefined

Implementation of

Logger.log


trace

readonly trace: (..._data) => undefined = NoOpLogFunction;

A log function that silently discards all arguments.

Parameters

_data

...unknown[]

Returns

undefined

Implementation of

Logger.trace


warn

readonly warn: (..._data) => undefined = NoOpLogFunction;

A log function that silently discards all arguments.

Parameters

_data

...unknown[]

Returns

undefined

Implementation of

Logger.warn

  ### functions

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

@xylabs/logger


function NoOpLogFunction(..._data): undefined;

A log function that silently discards all arguments.

Parameters

_data

...unknown[]

Returns

undefined

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

@xylabs/logger


function getFunctionName(depth?): string;

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

Parameters

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

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

@xylabs/logger


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

Properties

debug

debug: LogFunction;

error

error: LogFunction;

info

info: LogFunction;

log

log: LogFunction;

trace

trace: LogFunction;

warn

warn: LogFunction;
  ### type-aliases

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

@xylabs/logger


type LogFunction = (...data) => void;

A generic logging function that accepts any number of arguments.

Parameters

data

...unknown[]

Returns

void

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

@xylabs/logger


type LogLevelKey = EnumKey<typeof LogLevel>;

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

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

@xylabs/logger


type LogLevelValue = EnumValue<typeof LogLevel>;

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

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

@xylabs/logger


type LogVerbosity = LogLevelKey;

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

  ### variables

    ### <a id="LogLevel"></a>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).