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 🙏

© 2025 – Pkg Stats / Ryan Hefner

@luckydye/log

v0.8.1

Published

A tiny JavaScript logging library inspired by charmbracelet/log.

Downloads

197

Readme

log

A small (<2KB gzipped minified) JavaScript logging library inspired by charmbracelet/log and docs.rs/env_logger.

Usage

npm i @luckydye/log

Examples

Log levels

import logger from '@luckydye/log';

const log = logger().prefix("Test").trace();

log.info("Log info");
log.error("This is an error!");
02/06/2024 00:38:05 INFO <log.spec.ts:7:13> Test: Hello, world!!
02/05/2024 13:32:53 ERROR <log.spec.ts:7:41> Test: This is an error!
03/01/2024 22:41:53 ERROR <log.spec.ts:43:25> testing err=Test error
SyntaxError: Test error
    at <parse> (:0)
    at <anonymous> (/Users/tihav/source/log/log.spec.ts:82:1)

Log images to supporting terminals

log.img(path.resolve("./success.png"));

Formatted arguments

log.warn('An Object', 'obj', { one: 2 });
02/06/2024 00:38:05 WARN <log.spec.ts:17:64> Text here obj=Object{"one":2}

JSON output

const logJson = logger().prefix('Json').trace().json();
logJson.info('Hello, world!');
{"ts":"2024-02-05T13:33:05.270Z","level":"info","prefix":"Json","location":"log.spec.ts:9:48","msg":"Hello, world!","args":["Hello, world!"]}

Deno

import logger from "npm:@luckydye/log";

const log = logger().prefix("Deno");
log.error("Test error");

InfluxDB

Send logs to a InfluxDB (v2).

import logger from "@luckydye/log";
import { InfluxWriteStream } from '@luckydye/log/influx';

const log = logger()
  .prefix('Influx')
  .pipeTo(
    new InfluxWriteStream({
      org: 'organisation',
      bucket: 'bucket_name',
      db: 'database_name',
      url: 'https://influxdb.example.com',
      token: 'ACCESS_TOKEN',
    })
  );

// JS_LOG filtering applies here as well
log.info('Hello, world!');

Environment variables

JS_LOG

Set the log level. Default is info.

Set log level for specific prefixes.

JS_LOG=[prefix][=][level][,...]
JS_LOG = "error,Test=debug"

Configuration

Prefix

const log = logger().prefix("Topic");

Enable stack trace

Display last frame of stack trace in the output.

const log = logger().trace();

Set time format

Set the time format. Default is local. Set to false to disable time.

const log = logger().time("local" | "kitchen" | "iso" | "utc");

// disable time
const log = logger().time(false);

Enable json output

const log = logger().json();

Pipe log messages to arbitrary stream

const log = logger().pipeTo(WriteableStream);