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

@a14313/logger

v1.3.1

Published

A lightweight, zero-config wrapper for pino, the fastest Node.js logger. Get a production-ready logger instance instantly with sensible defaults, automatic pretty-printing in development, and built-in context, allowing you to skip the setup and start logg

Readme

npm version

@a14313/logger

A lightweight, zero-config wrapper for pino, the fastest Node.js logger. Get a production-ready logger instance instantly with sensible defaults, automatic pretty-printing in development, and built-in context, allowing you to skip the setup and start logging immediately.

Installation

NPM

npm i @a14313/logger

PNPM

pnpm i @a14313/logger

Usage

By default, you don't need to instantiate the logger. When you import the logger, it is automatically instantiated. However, you can import the Logger class if you want to instantiate it yourself. Example: const newLogger = new Logger();. But to make it simpler, just use the logger with the small L.


Setup

Set these variables to your environment:

LOG_LEVEL=debug
NODE_ENV=dev

LOG_LEVEL can have these values: debug | info | warn | error | fatal

NODE_ENV can have these values: dev | development | prod | prd | production

CommonJS

const logger = require('@a14313/logger');

logger.debug('This is debug');

logger.info('This is info with extra data', {
	foo: 'bar',
	baz: 1,
	bool: true,
});

logger.warn('This is Warning!');

logger.error('This is Error!');

logger.fatal('This is Fatal!');

ESM Modules

If you are having issues importing it from Typescript or ES6 codes, go to the troubleshooting guide.

import logger from '@a14313/logger';

logger.debug('This is debug');

logger.info('This is info with extra data', {
	foo: 'bar',
	baz: 1,
	bool: true,
});

logger.warn('This is Warning!');

logger.error('This is Error!');

logger.fatal('This is Fatal!');

Sample output

Development

Dev Logs

[2025-12-03 01:45:35.835 UTC] DEBUG (17472 on LPHLIFEFS8ZDY3): BAx1cWEBAjVzO_wDjvvXw This is debug
[2025-12-03 01:45:35.837 UTC] INFO (17472 on LPHLIFEFS8ZDY3): xNjfGrcjM_nHF3FWOM-8L This is info with extra data
    data: {
      "foo": "bar",
      "baz": 1,
      "bool": true
    }
[2025-12-03 01:45:35.837 UTC] WARN (17472 on LPHLIFEFS8ZDY3): qxRedJg6X3ve_OA5a3Xun This is Warning!
[2025-12-03 01:45:35.837 UTC] ERROR (17472 on LPHLIFEFS8ZDY3): xa1Vc93OKNcq9p14-3X3m This is Error!
[2025-12-03 01:45:35.837 UTC] FATAL (17472 on LPHLIFEFS8ZDY3): XeLmK1E3YY-kPGBehiYG3 This is Fatal!

Production

Prod Logs

{"level":20,"time":"2025-12-03T01:46:58.616Z","pid":36532,"hostname":"LPHLIFEFS8ZDY3","traceId":"oiZ0bVy86qimGtk_KYXSC"
,"msg":"This is debug"}
{"level":30,"time":"2025-12-03T01:46:58.618Z","pid":36532,"hostname":"LPHLIFEFS8ZDY3","traceId":"swux-WaDziXWy_jcCP_Y1"
,"msg":"This is info with extra data","data":{"foo":"bar","baz":1,"bool":true}}
{"level":40,"time":"2025-12-03T01:46:58.618Z","pid":36532,"hostname":"LPHLIFEFS8ZDY3","traceId":"LxFi797eny5F7-2UcQ2EY"
,"msg":"This is Warning!"}
{"level":50,"time":"2025-12-03T01:46:58.618Z","pid":36532,"hostname":"LPHLIFEFS8ZDY3","traceId":"7NgeGuNWdIOt6xnT7-20K"
,"msg":"This is Error!"}
{"level":60,"time":"2025-12-03T01:46:58.618Z","pid":36532,"hostname":"LPHLIFEFS8ZDY3","traceId":"lsp3XCMfEWGYvv3IrFN5-"
,"msg":"This is Fatal!"}

Instantiating your own Logger

If you decided to instantiate your Logger, you can override the defaults.

const myLogger = new Logger({options})

Options

| Parameter | Type | Required | Default | Description | | :-------- | :-------- | :------- | :--------------------------------------------------------------------------------------------------------------- | :----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | logLevel | String | No | info | These are the valid values for logLevel: debug | info | warn | error | fatal | | usePretty | Boolean | No | Depends on the environment. If the environment set on the env is prod, the default is false otherwise true | This will override the default logger if it will use json or pino-pretty regardless of the environment. WARNING⚠️: It is not recommended to use pretty logs on prod. It is resource intensive and the log processors might not be able to read your logs properly. Use this on dev environment only. Or better if you use the default, because it will automatically adjust depending on the environment. 😉 |

const { Logger } = require('@a14313/logger');

// or
// import { Logger } from '@a14313/logger';

const newLogger = new Logger({
	logLevel: 'info',
	usePretty: true,
});

newLogger.debug('This is debug');
newLogger.info('This is info');

Integration with pino-http (For backend)

When you need to integrate on pino-http to get the http requests, you need to configure the pino-http to use your existing logger. Just use the logger.raw or if you instantiated your own logger, myNewLogger.raw to use the installed logger a14313/logger, and that's it.

const logger = require('@a14313/logger');

pinoHttp({
	logger: logger.raw,
	// ... The rest of the config
});

Fixing some issues with the Typescript

You can use this technique if you are having problems importing it. Otherwise, don't use this.

If you ever came to a point where you cannot import it properly on your typescript or ES6 project, that is because I exported this package with plain vanilla javascript in mind, for backwards compatibility. So that even on commonjs, you can use this.

Fix

Solution 1

For maximum compatibility on typescript just add this on your tsconfig.json.

{
	"esModuleInterop": true,
	"allowSyntheticDefaultImports": true
}

This will allow you to import like a native ES6.

import logger from '@a14313/logger';

Solution 2

If you don't want to do the Solution 1 or you cannot modify the tsconfig, try this instead:

// First import the type of the Logger
import type { Logger } from '@a14313/logger';

// Use the "require" syntax and add the type "Logger".
// Then add this comment:

// eslint-disable-next-line @typescript-eslint/no-var-requires
const logger: Logger = require('@a14313/logger');

// Then you can use the logger as it is:
logger.debug('Debug log');
logger.info('Info log');

Author

The author of this API has an author to his name 😄.

Antonio Carlo Autor