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

@markox36/logger

v2.0.0

Published

Lightweight, customizable logger for Node.js (pino-backed)

Readme

@markox/logger

A lightweight, powerful, and highly customizable colorized logger for Node.js with TypeScript support.

✨ Features

  • 🎨 Fully Customizable: Define your own log types and colors.
  • 📂 File Logging: Automatically save logs to daily rotating files.
  • 🔍 Callsite Detection: Automatically identifies the file and line number where the log was called.
  • 🛡️ TypeScript First: Full type safety for your custom log types.
  • 🌑 No Boilerplate: No environment variables required, works out of the box.
  • 🏗️ Instance & Singleton: Use it as a class instance or via a shared singleton.

🚀 Installation

npm install @markox/logger
# or
pnpm add @markox/logger
# or
yarn add @markox/logger

🛠️ Usage

import { createLogger } from "@markox/logger";

const logger = createLogger({
  name: "MyProject",      // Optional: adds a name tag to all logs
  nameColor: "#00ffff",   // Optional: color for the name tag
  debug: true,            // Enable .debug() logs
  logToFile: true,        // Save logs to a file
  logDir: "./logs",       // Directory for log files
  
  // Custom log types and their colors
  types: {
    API:  "#42a5f5",
    DB:   "#4caf50",
    AUTH: "#ab47bc",
  },

  // Customize standard level colors
  levels: {
    info: "#ffffff",
    warn: "#ffcc00",
  }
});

logger.info("API", "Server started on port 3000");
logger.debug("DB", "Connection established", { host: "localhost" });
logger.warn("AUTH", "Login attempt failed", { user: "admin" });
logger.error("API", "Internal server error", new Error("Unexpected token"));

Using the Singleton

If you don't need a specific configuration everywhere, you can use the default logger:

import { getLogger } from "@markox/logger";

const logger = getLogger();
logger.info("APP", "This is the default logger instance");

Worker Identification

A common use case for the name property is identifying logs from different workers or instances:

// worker.ts
import { createLogger } from "@markox/logger";

const workerId = process.env.WORKER_ID || "Main";
const logger = createLogger({
  name: `Worker-${workerId}`,
  nameColor: workerId === "Main" ? "#00ffff" : "#ff8800",
});

logger.info("JOB", "Processing task #123");
// Output: [Date] | INFO | worker.ts:10 | Worker-1 | [JOB] Processing task #123

⚙️ Configuration Properties

| Property | Type | Default | Description | | :--- | :--- | :--- | :--- | | name | string | undefined | A name tag displayed at the start of every log. | | nameColor | string | "#00ffff" | Hex color for the name tag. | | debug | boolean | false | Whether to display debug level logs. | | logToFile | boolean | false | If true, logs will be written to a file in logDir. | | logDir | string | "./logs" | Path where log files will be stored. | | types | Record<string, string> | {} | Custom log categories (keys) and their hex colors (values). | | levels | Partial<Record<LogLevel, string>> | (Varies) | Override colors for standard levels (debug, info, warn, error). |

🧩 TypeScript Support

The logger smartly infers your custom types, providing autocomplete and type checking:

const logger = createLogger({
  types: {
    NETWORK: "#00ff00",
  }
});

// TypeScript will suggest "NETWORK" and warn if you use something else
logger.info("NETWORK", "Request sent"); 

Made with ❤️ by Markox