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

@itsukichan/consolefy

v1.0.0

Published

a customizable logging library.

Readme

consolefy

@itsukichan/consolefy is a customizable logging library 🙂.

Installation

npm i @itsukichan/consolefy
# or
yarn add @itsukichan/consolefy
# or
pnpm add @itsukichan/consolefy

Usage

Basic Example

import { Consolefy } from "@itsukichan/consolefy";

const consolefy = new Consolefy();

consolefy.log("Just a regular log.");
consolefy.info("This is an info log.");
consolefy.success("Operation was successful!");
consolefy.warn("This is a warning.");
consolefy.error("An error occurred.");

Customizing

You can customize the prefixes, formats, themes, and tags in the consolefy's configuration.

import { Colors, Consolefy } from "@itsukichan/consolefy";
const consolefy = new Consolefy({
  prefixes: {
    warn: "Caution",
    success: "Done",
    error: "Oops",
    info: "Heads up",
  },
  theme: {
    warn: (text) => Colors.bgYellow(Colors.black(text)),
    success: (text) => Colors.bgGreen(Colors.black(text)),
    error: (text) => Colors.bgRed(Colors.black(text)),
    info: (text) => Colors.bgBlue(Colors.black(text)),
  },
  format: "{prefix}{tag} {message}",
  tag: "APP",
});

consolefy.info("Info log with custom tag and theme.");
consolefy.success("Custom success log.");

Customizing Both Prefix and Theme Dynamically

You can also combine both setPrefix() and setTheme() to customize both the prefix and theme for specific log levels dynamically:

import { Colors, Consolefy } from "@itsukichan/consolefy";
const consolefy = new Consolefy();

// Set a custom prefix and theme for the 'info' log level
consolefy.setPrefix("info", "INFORMATION");
consolefy.setTheme("info", (text) => Colors.bgMagenta(Colors.black(text)));

consolefy.info("This is an informational message with a custom prefix and theme.");

Using setPrefix() and setTheme() methods, you can change the behavior and appearance of your log messages at any point, giving you full flexibility to adapt the logger to different contexts during runtime.

Grouping Logs

You can group related logs together using the group() and groupEnd() methods.

const consolefy = new Consolefy();

consolefy.group("Initialization");
consolefy.info("Initializing the application...");
consolefy.success("Initialization complete.");
consolefy.groupEnd();

Setting Log Levels

You can define new log levels dynamically by using the defineLogLevel() method.

import { Colors, Consolefy } from "@itsukichan/consolefy";
const consolefy = new Consolefy();

// Define a new log level "debug"
consolefy.defineLogLevel("debug", { prefix: "DEBUG", theme: (text) => Colors.bgRedBright(Colors.black(text)) });

consolefy.log("debug", "This is a debug message.");

Silent Mode

To disable logging output entirely, you can set the logger to silent mode.

const consolefy = new Consolefy();

consolefy.silent(true);
consolefy.info("This log will not be printed because silent mode is enabled.");

consolefy.silent(false);
consolefy.info("This log will be printed.")

Reset Configuration

You can reset the format and tag back to their default values.

const consolefy = new Consolefy();

// Change the format and tag
consolefy.setFormat("{prefix} - {message}");
consolefy.setTag("CUSTOM_TAG");

// Reset to defaults
consolefy.resetFormat();
consolefy.resetTag();

More Example

For more usage examples and demonstrations of different features, please refer to the example/example.ts file.

API

new Consolefy(config: Config = {})

Creates a new instance of the logger with optional configuration.

Config Options:

  • prefixes: Custom prefixes for different log levels (warn, success, error, info, etc.)
  • format: Custom format for log messages (default: {prefix}{tag} {message})
  • silent: Whether to suppress all logging (default: false)
  • tag: Custom tag to be appended to each log message
  • theme: Custom themes for each log level (functions that receive the log message and return the styled message)

setConfig(newConfig: Config): void

Sets the configuration of the logger.

setPrefix(type: string, prefix: string): void

Sets a custom prefix for the specified log level.

setTheme(type: string, theme: (text: string) => string): void

Sets a custom theme (color/style) for the specified log level.

setFormat(format: string): void

Sets a custom log message format.

resetFormat(): void

Resets the log message format to the default.

setTag(tag: string): void

Sets a custom tag to be appended to each log message.

resetTag(): void

Resets the log tag to the default (empty).

silent(state: boolean): void

Enables or disables silent mode.

defineLogLevel(level: string, options: { prefix: string; theme?: (text: string) => string }): void

Defines a custom log level with a specific prefix and theme.

group(name: string): void

Begins a log group with the given name.

groupEnd(): void

Ends the current log group.

log(level: string, ...messages: any[]): void

Logs a message at the specified log level.

warn(...messages: any[]): void

Logs a warning message.

success(...messages: any[]): void

Logs a success message.

error(...messages: any[]): void

Logs an error message.

info(...messages: any[]): void

Logs an informational message.