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

@norke/logger

v1.0.2

Published

A simple, styled logger with Dracula theme for the browser console.

Readme

@yourname/logger

A simple, stylish, zero-dependency logger for the browser console, themed with the Dracula color palette. Supports log levels, timestamps, namespaces, groups, custom styles, and log hooks.


Installation

```bash npm install @yourname/logger ```


Quick Example

```js import { createLogger } from '@yourname/logger';

const logger = createLogger({ namespace: 'MyApp', showTimestamp: true });

logger.debug('Debugging...'); logger.log('Plain log.'); logger.info('Some info.'); logger.warn('Careful...'); logger.error('Oops!'); logger.success('It worked!');

logger.group('Grouped logs', () => { logger.log('Inside the group'); logger.info('Another message'); }); ```


Options

`createLogger(options)` accepts an optional config object:

| Option | Type | Default | Description | | ----------------- | ------------------ | -------------- | ------------------------------------------------------ | | `namespace` | `string` | `undefined` | A prefix shown before each log line. | | `showTimestamp` | `boolean` | `false` | If`true`, prepends the current time to each log. | | `styles` | `LoggerStyleMap` | Dracula colors | Override the default per-level console styles. | | `level` | `LogLevel` | `'debug'` | Minimum log level to output. Lower levels are skipped. |


Supported Log Levels

| Level | Description | | ----------- | ---------------------------- | | `debug` | Detailed debug output. | | `log` | General log output. | | `info` | Informational message. | | `warn` | Warning, needs attention. | | `error` | Error or failure. | | `success` | Success or positive outcome. |

Logs below the configured `level` are filtered out.


Default Styles (Dracula Theme)

```js { debug: 'color: #6272a4;', log: 'color: #f8f8f2;', info: 'color: #8be9fd; font-weight: bold;', warn: 'color: #f1fa8c; font-weight: bold;', error: 'color: #ff5555; font-weight: bold;', success: 'color: #50fa7b; font-weight: bold;' } ```

Override any levels style: ```js const logger = createLogger({ styles: { error: 'color: red; font-weight: bold;', success: 'color: green;' } }); ```


API Reference

`createLogger(options)`

Creates a logger instance.

Returns an object with:

| Method | Description | | -------------------------- | --------------------------------------------------------------------------------- | | `debug(...args)` | Logs a debug message. | | `log(...args)` | Logs a plain message. | | `info(...args)` | Logs an info message. | | `warn(...args)` | Logs a warning. | | `error(...args)` | Logs an error. | | `success(...args)` | Logs a success message. | | `group(title, callback)` | Runs logs inside a`console.groupCollapsed`. Ends automatically. Supports async. | | `setEnabled(value)` | Enables or disables all logging dynamically. | | `onLog(callback)` | Registers a custom hook triggered on every log. Returns an unsubscribe function. |


`group`

Run related logs inside a collapsible group.

```js logger.group('Loading Data', () => { logger.debug('Step 1...'); logger.debug('Step 2...'); }); ```

Async supported:

```js await logger.group('Async Task', async () => { await doSomething(); logger.success('Done!'); }); ```


`setEnabled`

Enable/disable output on the fly.

```js logger.setEnabled(false); // Silence logs logger.setEnabled(true); // Resume logs ```


`onLog`

Register a hook for custom log handling (e.g. send logs to a server).

```js const unsubscribe = logger.onLog((level, meta) => { console.log('HOOK:', meta); // meta = { timestamp, namespace, level, args } });

unsubscribe(); // Remove the hook ```


Type Definitions

The library is fully documented with JSDoc:

```ts type LogLevel = 'debug' | 'log' | 'info' | 'warn' | 'error' | 'success';

type LoggerStyleMap = { debug?: string; log?: string; info?: string; warn?: string; error?: string; success?: string; };

type LoggerOptions = { namespace?: string; showTimestamp?: boolean; styles?: LoggerStyleMap; level?: LogLevel; }; ```


Example: Custom Styles & Hooks

```js const logger = createLogger({ namespace: 'MyApp', showTimestamp: true, styles: { info: 'color: #00f; font-weight: bold;' }, level: 'info' });

// Only info, warn, error, success will be shown logger.debug('Will not be shown'); logger.info('Will be shown');

// Add a hook const unsub = logger.onLog((level, meta) => { sendToServer(meta); }); ```


Summary of Features

No dependencies Fully tree-shakable ESM Dracula theme by default Log levels with filtering Optional timestamps and namespaces Console `groupCollapsed` helper Custom hooks for advanced handling


License

MIT Your Name


Author

Your Name