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

@ekino/logger

v3.0.0

Published

A Lightweight logger that combines debug namespacing capabilities with winston levels and multioutput

Readme

@ekino/logger

A lightweight, flexible logger that merges debug-style namespace management, Winston-inspired log levels, and customizable multi-output functionality.

NPM version Coverage Status

Table of Contents

Features

  • Set log levels globally or per namespace for detailed control.
  • Supports JSON, Pretty-print, and custom output adapters.
  • Optionally track logs across function calls by assigning a unique context ID.
  • Fully written in TypeScript for improved safety and ease of use.
  • Supports both ESM and CommonJS imports.
  • Works with Node.js, Deno, and Bun environments.

Installation

Install via npm, yarn or pnpm:

npm  add @ekino/logger
yarn add @ekino/logger
pnpm add @ekino/logger

Git hooks

This package configures local Git hooks for the repository by setting:

core.hooksPath = ./.githooks

This is done automatically during installation to ensure Git hooks are consistently enabled for contributors.

Usage

By default, @ekino/logger outputs warn and error levels for all namespaces, with logs written to stdout in JSON format.

Adjust the log level globally or per namespace using the LOG_LEVEL environment variable or programmatically with setLevel and setNamespaces.

Basic logging

@ekino/logger provides five log levels: trace, debug, info, warn, and error. Setting a specific level enables it and all higher-priority levels.

By default, setting info will enable info, warn, and error, but not debug or trace. The log levels are defined as:

Log level priorities:

{ trace: 0, debug: 1, info: 2, warn: 3, error: 4 }

Example:

import { setNamespaces, setLevel, createLogger } from '@ekino/logger'

setNamespaces('root:*')
setLevel('debug')

const logger = createLogger('root:testing')
logger.debug('Sample debug message', { foo: 'bar' })

Output example:

Example

Context ID

For traceability, the logger supports a contextId, helping to link logs across calls. You can either provide a custom contextId or let the logger auto-generate one.

const logger = createLogger('app:example')
logger.debug('ctxId', 'Log with predefined context ID', { foo: 'bar' })
// Or logger.debug('Log with predefined context ID', { foo: 'bar' })

Output example:

Example

Namespaces and levels

Namespaces offer flexibility for selectively enabling logs. Set a default global log level and configure specific namespaces with unique levels, including none to disable.

To configure namespaces:

const { setLevel, setNamespaces } = require('@ekino/logger')

setLevel('info')
setNamespaces('*,database*=debug,database:redis*=none')

Example of using namespace-specific logging:

const loggerA = createLogger('namespace:subNamespace')
const loggerB = createLogger('namespace:mute')

loggerA.debug('This will be logged')
loggerB.info('This will not be logged')

Output formats

@ekino/logger supports multiple output formats with default JSON logging to stdout. You can enable pretty output or create custom adapters.

JSON format

The JSON output adapter logs structured data, ideal for integration with log collectors.

setOutput(outputs.json)
const logger = createLogger('namespace:subNamespace')
logger.debug('ctxId', 'Log message', { someData: 'value' })

Output example:

Example

Pretty format

The Pretty format outputs logs in a YAML-like style for enhanced readability in local development.

setOutput(outputs.pretty)
const logger = createLogger('namespace:subNamespace')
logger.debug('ctxId', 'Log message', { someData: 'value' })

Output example:

Example

Custom output functions

Custom output functions allow flexible handling of log data. Pass an array of adapters for multiple outputs.

const consoleAdapter = (log) => {
    console.log(outputUtils.stringify(log))
}

setOutput([outputs.pretty, consoleAdapter])
const logger = createLogger('namespace:subNamespace')
logger.debug('ctxId', 'Log message', { someData: 'value' })

Log data and metadata

Adding metadata to logs enhances context and helps filter data in log collectors. Add custom data directly or globally to each log instance.

const logger = createLogger('namespace:subNamespace')
logger.warn('Log message', { additionalData: 'value' })

Output example:

Example

Adding global metadata

Use setGlobalContext to add metadata, such as app version or environment, to all log entries.

setGlobalContext({ version: '2.0.0', env: 'dev' })
const logger = createLogger('namespace')
logger.warn('Log message', { additionalData: 'value' })

Output example:

Example

Force logging

Override the log level for critical messages by forcing them to be logged:

logger.debug('Will be logged regardless of level', { forceLogging: true })

Contributing

Contributions are welcome! Please refer to our CONTRIBUTING.md for guidelines on submitting issues, improvements, and more.