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

@basenative/logger

v3.3.0

Published

Structured logging with multiple transports and child logger support

Readme

@basenative/logger

Structured JSON logging with Pino-compatible output, transports, and child loggers

Part of the BaseNative ecosystem — a signal-based web runtime over native HTML.

Install

npm install @basenative/logger

Quick Start

import { createLogger } from '@basenative/logger';

const log = createLogger({ name: 'api', level: 'info' });

log.info('Server started', { port: 3000 });
log.warn('Slow query', { duration: 1200, table: 'users' });
log.error('Unhandled error', { err });

Child Loggers

const requestLog = log.child({ requestId: 'abc-123' });
requestLog.info('Incoming request'); // always includes requestId

Request Middleware

import { createLogger, requestLogger } from '@basenative/logger';
import { createPipeline } from '@basenative/middleware';

const log = createLogger({ name: 'http' });

const pipeline = createPipeline().use(requestLogger(log));
// ctx.state.logger is now a child logger with requestId, method, url

API

createLogger(options?)

Creates a logger instance. Options:

  • level — Minimum log level: 'trace', 'debug', 'info', 'warn', 'error', 'fatal'. Default: 'info'.
  • name — Logger name, included in every log entry.
  • transport — Transport instance (default: consoleTransport()).
  • context — Static key/value pairs merged into every log entry.
  • timestamp — Include time field (milliseconds since epoch). Default: true.
  • pretty — Pretty-print with colors in development. Default: NODE_ENV !== 'production'.

Logger methods: trace, debug, info, warn, error, fatal — each accepts (msg, data?).

  • .child(context) — Returns a new logger inheriting all settings with additional static context.
  • .level — Read-only current level string.

Transports

  • consoleTransport() — Writes to console.log. Pretty-prints in development, JSON in production.
  • streamTransport(stream) — Writes JSON lines to any Node.js writable stream (e.g. a file stream).
  • multiTransport(transports[]) — Fans out to multiple transports simultaneously.

Middleware

  • requestLogger(logger, options?) — Middleware that creates a child logger per request with requestId, method, and url. Attaches it to ctx.state.logger. Options: idHeader (default: 'x-request-id').

License

Apache-2.0