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

log-timed

v1.1.0

Published

Lightweight logging with timestamps, colors and file support

Readme

log-timed

Lightweight logging with timestamps, colors and file support.

Uses chalk for colors.
File writing is asynchronous and doesn't block process.

Install

npm install log-timed

Usage

import { casual as log } from 'log-timed'

log('Simple message')
log.file('Log to console and file')
log.error('Error occurred')
log.multiline({ user: 'John', data: [1, 2, 3] })
log.compact('Line 1\nLine 2\nLine 3')

Custom logger

import createLogger from 'log-timed'

const log = createLogger({
    useDate: true, // show date
    useMs: true, // show milliseconds
    colorLeft: 'blue', // timestamp color
    file: 'app_', // file prefix
})

log('Custom logging')

Methods

Basic:

  • log() - standard logging
  • .log(...args) - multiple arguments like console.log
  • .logFile(...args) - multiple arguments with file write
  • .file() - log to console and file
  • .fileOnly() - log to file only
  • .multiline() - multiline object output
  • .compact() - compress newlines to single line
  • .rewrite() - rewrite last console line
  • .clear() - clear terminal

Event logging:

  • .success() - success operations (green)
  • .info() - informational messages (cyan)
  • .warn() - warnings (yellow)
  • .error() - errors (red)
  • .debug() - debug info (dimmed)

Each event method has a *File() version for writing to file with corresponding prefix (e.g., success_, info_). To write to file without prefix, use method(data, { file: true }).

Presets

import { free, simple, casual, full, iso } from 'log-timed'

free('No timestamps') // No timestamps
simple('With time') // [03:00:00] With time
casual('With milliseconds') // [13:37:42.999] With milliseconds
full('Full date and time') // [2025.12.31 23:59:59.999] Full date and time
iso('ISO format') // [2025-10-21T01:21:00.000Z] ISO format

File logging

Logs are saved to ./logs/ directory with YYYY.MM.DD.log naming by default.

// Default file: ./logs/2025.11.07.log
log.file('message')
log('message', { file: true })

// With prefix: ./logs/error_2025.11.07.log
log('message', { file: 'error_' })
log.errorFile('message')

// Custom filename: ./logs/app.log
log('message', { file: 'app.log' })

// Custom path: ./custom/path/app.log
log('message', { file: './custom/path/app.log' })

// File only (no console output)
log('message', { fileOnly: true })

Multiline formatting

// Objects
log({ data: 'test' }) // {"data":"test"}
log({ data: 'test' }, { multiline: true }) // pretty JSON (4 spaces)
log({ data: 'test' }, { multiline: 2 }) // pretty JSON (2 spaces)

// Compact with separators
log('line1\nline2', { multiline: ' ' }) // "line1 line2"
log('line1\nline2', { multiline: '' }) // "line1line2"
log('line1\nline2', { multiline: ', ' }) // "line1, line2"

Config

  • useDate - show date
  • useMs - show milliseconds
  • colorLeft - timestamp color
  • colorRight - message color
  • colorMs - milliseconds color (default: 'gray')
  • color - set both colorLeft and colorRight
  • file - file prefix or boolean
  • leftFn - custom function for left part