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

@rx-ted/packages-logger

v0.0.1

Published

A lightweight logging library with file & console output, designed for Cloudflare/Node/Bun/Deno.

Downloads

79

Readme

@rx-ted/logger

A lightweight logging library with modular architecture — Logger, Handler, and Formatter separation. Supports multiple handlers, child loggers, and file rotation.

Features

  • Modular Architecture: Logger → Handler → Formatter separation
  • Multiple Handlers: Console and File handlers with independent configuration
  • Child Loggers: Inheritance with scope-based namespaces
  • File Rotation: Auto-dated filenames with max file count limits
  • Dual Formatters: JSON and TEXT formats
  • Multi-Runtime: Works with Bun, Node.js, Deno, and Cloudflare Workers

Install

pnpm add @rx-ted/logger

Quick Start

import { Logger } from "@rx-ted/logger";

const logger = new Logger({ name: "app" });

logger.info("Hello World");
logger.debug("Debug info", { userId: 123 });
logger.warn("Warning message");
logger.error("Error occurred", { code: "ERR_001" });

Logger Options

| Option | Type | Default | Description | | ----------- | ---------------------------------------- | --------- | ---------------------- | | name | string | 'app' | Logger namespace | | scope | string | - | Child logger scope | | level | 'debug' \| 'info' \| 'warn' \| 'error' | 'info' | Log level | | handlers | HandlerConfig[] | console | Handler configurations | | propagate | boolean | true | Propagate to parent | | onError | (err: LogError) => void | - | Error callback |

Handlers

Console Handler

const logger = new Logger({
  name: "app",
  handlers: [
    {
      type: "console",
      level: "debug",
      formatter: {
        type: "text",
        template: "[{time}] [{level}] {namespace}: {message}",
        colors: true,
      },
    },
  ],
});

File Handler

const logger = new Logger({
  name: "app",
  handlers: [
    {
      type: "file",
      level: "info",
      formatter: { type: "json" }, // or 'text'
      maxSize: "10MB", // default: 10MB
      maxFiles: 7, // default: 7
    },
  ],
});

File handler features:

  • Auto-dated filenames: app.2026-04-20.json
  • Automatic old file cleanup when exceeding maxFiles
  • Automatic date rollover at midnight

Child Loggers

const logger = new Logger({ name: "app" });

const child = logger.child("module");

console.log(child.namespace); // "app.module"

Child loggers:

  • Inherit parent's handlers by default
  • Inherit parent's level
  • Disable propagation by default (set propagate: true to enable)
  • Require scope option (cannot use name)

Methods

  • debug(message, context?) - Debug level
  • info(message, context?) - Info level
  • warn(message, context?) - Warning level
  • error(message, context?) - Error level
  • child(scope, options?) - Create child logger
  • setLevel(level) - Change log level
  • addHandler(handler) - Add handler
  • close() - Close all handlers

Error Handling

const logger = new Logger({
  name: "app",
  handlers: [
    {
      type: "file",
      onError: (err) => {
        console.error("Handler error:", err.error);
      },
    },
  ],
  onError: (err) => {
    console.error("Logger error:", err.error);
  },
});

Runtime Notes

  • File handler is automatically disabled in Cloudflare Workers environment
  • Supports Bun, Node.js, and Deno runtimes

Testing

pnpm test          # Run tests
pnpm test:coverage     # Run with coverage