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

@h1s97x/logger

v0.1.1

Published

Universal isomorphic logger with structured JSON output, child loggers, pluggable transports, and automatic redaction

Downloads

325

Readme

@h1s97x/logger

Universal isomorphic logger with structured JSON output. Inspired by pino, designed for both browser and Node.js environments.

Features

  • Six log levels: trace, debug, info, warn, error, fatal
  • Structured JSON output — every log is a valid JSON object
  • Child loggers with inherited configuration and bound context
  • Pluggable transport layer — console, file, HTTP, Supabase, or custom
  • Automatic redaction of sensitive fields (e.g. password, token)
  • Serializer support for safe Error serialization
  • Dynamic context injection via mixin
  • Zero core dependencies, lightweight and fast

Install

pnpm add @h1s97x/logger
# or
npm install @h1s97x/logger

Quick Start

import { createLogger } from '@h1s97x/logger'

const logger = createLogger({
  name: 'my-app',
  level: 'info',
})

logger.info({ userId: 'u1' }, 'user login')
// {"level":30,"time":"2026-05-28T07:00:00.000Z","msg":"user login","userId":"u1","name":"my-app"}

API

createLogger(options)

Creates a new Logger instance.

const logger = createLogger({
  name: 'my-app',         // Logger name, included in each log line
  level: 'info',          // Minimum level (default: 'info')
  base: { app: 'bank' },  // Base fields merged into every log
  serializers: {          // Keyed serializers for log fields
    err: stdSerializers.err,
  },
  redact: ['password', 'user.token'],  // Fields to redact
  transport: customTransport,          // Custom transport(s)
  mixin: () => ({ seq: ++counter }),   // Dynamic context
  timestamp: true,                     // true, false, or custom fn
})

logger.child(bindings)

Creates a child logger that inherits parent configuration and appends bound context.

const taskLogger = logger.child({ module: 'task-service', taskId: 'abc-123' })
taskLogger.info({ status: 'running' }, 'task started')

Log Methods

logger.trace(obj, msg?)
logger.debug(obj, msg?)
logger.info(obj, msg?)
logger.warn(obj, msg?)
logger.error(obj | Error, msg?)
logger.fatal(obj | Error, msg?)

Error Handling

import { createLogger, stdSerializers } from '@h1s97x/logger'

const logger = createLogger({
  serializers: { err: stdSerializers.err },
})

try {
  // ...
} catch (err) {
  logger.error(err, 'operation failed')
  // Serializes Error to { type, name, message, stack, cause }
}

Redaction

const logger = createLogger({
  redact: ['password', 'creditCard', 'user.ssn'],
})

logger.info({ username: 'alice', password: 'secret123' }, 'login')
// password field will be replaced with '[Redacted]'

Custom Transport

import { createLogger } from '@h1s97x/logger'
import type { Transport, LogObject } from '@h1s97x/logger'

const httpTransport: Transport = {
  write(logObj: LogObject) {
    fetch('/api/logs', {
      method: 'POST',
      body: JSON.stringify(logObj),
      headers: { 'Content-Type': 'application/json' },
    })
  },
  onError(err, logObj) {
    console.error('Failed to send log:', err.message)
  },
}

const logger = createLogger({ transport: httpTransport })

Built-in Transports

ConsoleTransport

import { createLogger, createConsoleTransport } from '@h1s97x/logger'

const logger = createLogger({ transport: createConsoleTransport() })

Level Thresholds

| Level | Value | Description | |-------|-------|-------------| | trace | 10 | Most verbose, detailed tracing | | debug | 20 | Debugging information | | info | 30 | General information (default) | | warn | 40 | Warning conditions | | error | 50 | Error conditions | | fatal | 60 | Fatal conditions requiring immediate attention |

License

MIT