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

@napp/logger

v4.1.9

Published

low level log archigture. minimum resources, user friendly, powerfull logger library. supported browser & nodejs

Readme

@napp/logger

Low-overhead, extensible logger core for Node.js and modern browsers.

  • Runtime dependency-free
  • Hierarchical logger names (app.core.api)
  • Writer routing with filterLogname + filterLevel
  • Pluggable levelParser and errorParser
  • Full + short methods: trace/debug/info/warn/error/fatal and t/d/i/w/e/f
  • TypeScript types included (dist/index.d.ts)

Install

npm install @napp/logger

Quick Start

import { LogManager, LogLevel, getLogger } from '@napp/logger';

const manager = new LogManager();

manager.addWriter({
  writerName: 'console',
  filterLogname: 'app',
  filterLevel: LogLevel.Warn,
  doWriter: (log) => {
    console.log(
      `[${log.levelText}] ${log.logname} ${log.message}`,
      log.attr
    );
  }
});

LogManager.setDefault(manager);

const logger = getLogger('app.core');
logger.info('not written (below Warn)');
logger.warn('written', { module: 'bootstrap' });
logger.error('failed');

Core Concepts

LogManager

  • Owns writers and dispatches each ILogItem
  • addWriter({ writerName?, filterLogname?, filterLevel?, doWriter })
  • removeWriter(writerName)
  • Global default manager:
    • LogManager.setDefault(manager)
    • LogManager.getDefault()

Logger

Created from:

  • manager.factory(logname, opt?), or
  • getLogger(logname, opt?) (requires default manager)

Main methods:

  • trace/debug/info/warn/error/fatal
  • aliases: t/d/i/w/e/f
  • log(level: string | number, message, attr?)
  • errorThrow(err, message, attr?)
  • child(childName, { inheritBaseAttr?, baseAttr?, errorParser?, levelParser? })
  • isLevelEnabled(level)

Writer Filtering

  • filterLogname: string | string[]
    • Prefix match on logger path
    • Example: app.core matches app.core and app.core.repo
  • filterLevel: LogLevel | string
    • Minimum accepted severity for that writer

Levels

LogLevel values:

  • Trace = 1
  • Debug = 5
  • Info = 9
  • Warn = 13
  • Error = 17
  • Fatal = 21

Helpers:

  • LogManager.getSeverityText(level) -> TRACE|DEBUG|INFO|WARN|ERROR|FATAL
  • Built-in parser accepts:
    • strings: trace|debug|info|warn|error|fatal
    • numeric ranges (mapped to nearest level band)

Attributes and Error Handling

ILogItem includes:

  • timestamp
  • level
  • levelText
  • logname
  • logpath
  • message
  • attr?

Attribute sanitization behavior:

  • Date -> ISO string
  • Error -> parsed with active errorParser
  • arrays/objects -> recursively sanitized

Custom Parsers

import { LogLevel, LogManager } from '@napp/logger';

// Level parser for logger.log(level, ...)
LogManager.setDefaultLevelParser((level) => {
  if (level === 'notice') return LogLevel.Info;
  return false;
});

// Error parser for logger.errorThrow(...)
LogManager.setDefaultErrorParser((error) => ({
  name: error.name,
  message: error.message,
  stack: error.stack
}));

API Snapshot

import {
  LogManager,
  LogLevel,
  getLogger,
  type ILogItem,
  type IAttrObject,
  type IError,
  type IErrorParser,
  type ILevelParser
} from '@napp/logger';

Notes

  • Package exports both ESM and CJS builds
  • Development/test engine in package.json: Node >=22
  • Works in browser and Node.js (writer implementation is user-defined)

License

MIT