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

@heojeongbo/log-palette

v0.2.2

Published

Browser logging library with domain-based colored prefixes

Readme

log-palette

Browser logging library with domain-based colored prefix badges.

Each logger is bound to a named domain (e.g. auth, api, payments) and outputs a fixed-width, color-coded badge in the browser DevTools console — making it easy to visually filter log output in complex frontend applications.

Installation

npm install @heojeongbo/log-palette
# or
bun add @heojeongbo/log-palette

Quick Start

import { createLogger } from '@heojeongbo/log-palette'

const log = createLogger('auth')

log.info('User signed in', { userId: 42 })
// → [....auth] 05:35:41.039 User signed in { userId: 42 }

API

createLogger(domain, options?)

Creates a new logger instance. Each call returns a fresh instance.

const log = createLogger('payments', { color: '#16a34a', level: 'warn' })

getLogger(domain, options?)

Returns a singleton logger for the given domain — the same instance is returned every time the same domain is used. Options are only applied on first call.

// In module A
const log = getLogger('api')

// In module B — same instance
const log = getLogger('api')

Logger Methods

| Method | Description | |---|---| | log(...args) | Log at log level | | info(...args) | Log at info level | | warn(...args) | Log at warn level | | error(...args) | Log at error level | | debug(...args) | Log at debug level | | group(label) | Open a collapsible DevTools group | | groupCollapsed(label) | Open a collapsed DevTools group | | groupEnd() | Close the most recently opened group | | time(label) | Start a named performance timer | | timeEnd(label) | Stop the timer and log elapsed time | | setLevel(level) | Change the minimum log level at runtime | | setEnabled(enabled) | Enable or disable this logger at runtime |

LoggerOptions

| Option | Type | Default | Description | |---|---|---|---| | color | string | auto | CSS color for the prefix badge. If omitted, a color is derived from the domain name via djb2 hash. | | level | LogLevel | 'debug' | Minimum log level. Levels below this are silently dropped. | | enabled | boolean | true | When false, all output is suppressed. |

Log level order (lowest → highest): debug < log < info < warn < error

Global Configuration

Use configure() to change formatting settings that apply to all loggers.

import { configure } from '@heojeongbo/log-palette'

// Wider prefix column (useful for long domain names)
configure({ innerWidth: 12 })

// Disable timestamps
configure({ timestamp: false })

| Option | Type | Default | Description | |---|---|---|---| | innerWidth | number | 8 | Number of characters inside the prefix brackets. Short domains are left-padded with dots; long domains are truncated with . | | timestamp | boolean | true | Whether to include a timestamp in each log line. |

Registry Utilities

import { getAllLoggers, setGlobalLevel, enableAll, disableAll } from '@heojeongbo/log-palette'

// Only show warnings and errors in production
if (import.meta.env.PROD) setGlobalLevel('warn')

// Silence all loggers
disableAll()

// Re-enable all loggers
enableAll()

// Inspect all registered loggers
const loggers = getAllLoggers()
console.log([...loggers.keys()]) // ['api', 'auth', 'payments']

Examples

Group & Timer

const apiLog = createLogger('api')

apiLog.group('Fetch /users')
apiLog.info('response', data)
apiLog.groupEnd()

apiLog.time('login')
await performLogin()
apiLog.timeEnd('login')
// DevTools: [.......api] login: 42.1ms

Production Setup

import { configure, setGlobalLevel, disableAll } from '@heojeongbo/log-palette'

if (import.meta.env.PROD) {
  disableAll()
} else {
  configure({ timestamp: true })
  setGlobalLevel('debug')
}

License

MIT