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

@molang/alogjs

v0.1.5

Published

A small TypeScript logger matching github.com/molang-dev/alogjs.

Readme

alogjs

alogjs is a TypeScript port of github.com/molang-dev/alogjs. It keeps the same logging model: package-level helpers, independent logger instances, console output, daily file output, text/JSON formats, and optional caller fields.

The default entry is browser-safe and does not import node:* modules. Use the Node entry when you need file output.

Features

  • Console logging.
  • File logging.
  • Daily log files named like 2026-07-11.log.
  • Configurable file output directory.
  • Configurable daily file prefix, such as app-2026-07-11.log.
  • Existing daily log files are appended to, not overwritten.
  • Console and file output can be enabled at the same time.
  • Text and JSON output formats can be configured separately for screen and file.
  • Optional caller fields can be enabled only at or above a configured level.
  • Package-level helpers such as I(...).
  • Default singleton log.
  • Independent logger instances through ALog().

Quick Start

import { log } from '@molang/alog'

log.V('Startup', 'verbose message')
log.D('Startup', 'debug message')
log.I('Startup', 'info message')
log.W('Startup', 'warning message')
log.E('Startup', 'error message')
log.Fatal('Startup', 'fatal message and exit')

Text output:

2026-07-11 13:55:34.386|V|12345|Startup|verbose message
2026-07-11 13:55:34.386|D|12345|Startup|debug message
2026-07-11 13:55:34.386|I|12345|Startup|info message
2026-07-11 13:55:34.386|W|12345|Startup|warning message
2026-07-11 13:55:34.386|E|12345|Startup|error message
2026-07-11 13:55:34.386|F|12345|Startup|fatal message and exit

Logger Instances

import { ALog, LevelDebug } from '@molang/alog'

const logger = ALog()
logger.SetLevel(LevelDebug)
logger.D('Sync', 'loaded %d items', 10)

Output Flags

import { FlagColor, FlagScreen, log } from '@molang/alog'

log.SetFlags(FlagScreen | FlagColor)
log.I('Main', 'screen')

Available flags:

  • FlagScreen: write to the configured screen writer.
  • FlagFile: write to the daily date file in the Node entry.
  • FlagColor: colorize text screen output with ANSI colors.

The default flags are:

FlagScreen | FlagColor

File Output

import { ALog, FlagFile, FlagScreen } from '@molang/alog/node'

const logger = ALog()
logger.SetDir('./logs')
logger.SetFilePrefix('app-')
logger.SetFlags(FlagScreen | FlagFile)
logger.I('File', 'screen and ./logs/app-2026-07-11.log')

This writes to:

./logs/app-2026-07-11.log

The directory is created when the first file log is written. Existing files are opened in append mode.

Format

The default text format is:

YYYY-MM-DD HH:mm:ss.SSS|Level|PID|Tag|Message

Set screen and file formats separately:

import { ALog, FormatJSON, FormatText } from '@molang/alog/node'

const logger = ALog()
logger.SetFormat(FormatText, FormatJSON)
logger.I('Startup', 'hello %s', 'world')

JSON output is one object per line:

{"time":"2026-07-11 13:55:34.386","level":"I","pid":12345,"tag":"Startup","msg":"hello world"}

If the message starts with a JSON object or array after leading whitespace and ends with the matching closing character before trailing whitespace, it is written as raw JSON:

logger.I('Price', ' { "price": "123" } ')
logger.I('Prices', ' [ {"price": "123"} ] ')
{"time":"2026-07-11 13:55:34.386","level":"I","pid":12345,"tag":"Price","msg": { "price": "123" } }
{"time":"2026-07-11 13:55:34.386","level":"I","pid":12345,"tag":"Prices","msg": [ {"price": "123"} ] }

Only the outer shape is checked. Invalid raw JSON remains the caller's responsibility.

Caller Fields

Caller fields are disabled by default because they parse Error().stack.

import { ALog, FlagFunc, FlagShortFile, LevelWarning } from '@molang/alog'

const logger = ALog()
logger.SetCallerFlags(LevelWarning, FlagShortFile | FlagFunc)
logger.W('Sync', 'slow response')

Example:

2026-07-11 13:55:34.386|W|12345|Sync|main.ts:23|main|slow response

Timing

const id = logger.Time()
// do work
logger.TimeEnd(id, 'Work', 'finished')

TimeEnd writes a debug log with an elapsed= suffix.

Fatal Logs

Fatal writes the fatal log and writes the current stack trace. In the Node entry it exits the process with status code 1; in the browser-safe entry it throws an error.