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

kt-logger

v1.1.2

Published

neat logger

Readme

kt-log

A lightweight, configurable logging utility for Node.js applications.
It supports dynamic configuration loading, colorized console output, and clustering-aware log handling.


🚀 Features

  • Dynamic Configuration via locate-config-kt
  • Cluster-Aware Logging (Primary and Worker process detection)
  • Configurable Console Override
  • Log Coloring
  • Timestamped Log Output
  • Customizable Log Levels

📦 Installation

npm install kt-log
# or
yarn add kt-log

🧩 Configuration

kt-log automatically loads a configuration file named log.kt.config.json using locate-config-kt.

Example Configuration (log.kt.config.json)

{
  "hideLogs": false,
  "overrideConsoleLog": true
}

| Property | Type | Description | |-----------|------|-------------| | hideLogs | boolean | If true, suppresses all log outputs. | | overrideConsoleLog | boolean | If true, replaces the native console methods with kt-log's logger. |

If no configuration file is found, kt-log falls back to default behavior (logs are shown, no console override).


⚙️ Usage

Example

import { createLogger, generalLogger } from "kt-log";

const logger = await createLogger({
  name: "Server",
  color: "cyan",
  logLevel: "Info",
  worker: false,
});

logger("Server started successfully!");
logger.warning("Server memory usage is high");
logger.error("Server crashed unexpectedly");

// Use the general logger (shared globally)
generalLogger("This is a general log");

Overriding Console Logs

If your configuration enables overrideConsoleLog, you can use native console methods directly:

console.log("This will use kt-log under the hood");
console.warn("Warning through kt-log");
console.error("Error via kt-log");

🧠 Logger API

createLogger(options)

Creates a custom logger instance.

| Option | Type | Description | |---------|------|-------------| | name | string | Identifier for the logger (e.g. "Server"). | | color | "black" | "red" | "green" | "yellow" | "blue" | "magenta" | "cyan" | "white" | "consoleColor" | Sets the color of log prefixes. | | logLevel | "Info" | "Warning" | "Error" | Defines the log severity level (default: "Info"). | | worker | boolean | Whether logs should appear in worker processes. |

Returns a logger function with the following methods:

  • logger(...msgs: any[])
  • logger.error(...msgs: any[])
  • logger.warning(...msgs: any[])

generalLogger

A preconfigured logger available globally with the name "General" and color "white".

forceLog

Direct reference to the original console.log, allowing bypass of suppression.


🎨 Colors

| Color | Escape Code | |--------|--------------| | black | \x1b[30m | | red | \x1b[31m | | green | \x1b[32m | | yellow | \x1b[33m | | blue | \x1b[34m | | magenta | \x1b[35m | | cyan | \x1b[36m | | white | \x1b[37m | | consoleColor | \x1b[0m |


🧪 Example Output

---[2025-11-04-13:42:10.512]-[ 24513 ]-[ SERVER ]-[ INFO ]--- Server started successfully!
---[2025-11-04-13:42:11.712]-[ 24513 ]-[ SERVER ]-[ WARNING ]--- Memory usage high!
---[2025-11-04-13:42:12.233]-[ 24513 ]-[ SERVER ]-[ ERROR ]--- Crash detected!

🧩 Dependencies


📄 License

MIT © Salem Elmotamed