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

logaste

v4.0.0

Published

结构化日志框架 v4 — Structured JSON logging with levels, sampling, context, remote config, audit logging, and pluggable transports

Readme

logaste v4

结构化日志框架 — The modern structured Node.js logger.

Logaste: structured JSON logging with level control, sampling, context propagation, remote configuration, tamper-evident audit logging, and pluggable transports. Zero dependencies.

npm install logaste

Quick Start

const { createLogger, ConsoleTransport } = require('logaste')

const log = createLogger({
  transports: [new ConsoleTransport({ pretty: true })],
})

log.info('Server starting', { port: 3000 })
log.warn('Memory high', { usage: '85%' })
log.error('Connection failed', new Error('ECONNREFUSED'))

Audit Logging (v4)

Tamper-evident, hash-chained audit trail for compliance and security.

const { AuditLogger } = require('logaste')

const audit = new AuditLogger({
  name: 'financial-system',
  filename: '/var/log/audit.log',
})

// Record auditable events
audit.audit('USER_LOGIN', {
  actor: '[email protected]',
  target: 'system',
  metadata: { ip: '10.0.0.1', role: 'admin' },
})

audit.audit('FUNDS_TRANSFER', {
  actor: '[email protected]',
  target: 'account-xyz',
  metadata: { amount: 5000, currency: 'USD' },
})

await audit.flush()

Verification

const { AuditVerifier } = require('logaste')

const result = AuditVerifier.verify('/var/log/audit.log')
console.log('Audit log valid:', result.valid) // true/false
console.log('Entries:', result.entries)
console.log('Errors:', result.errors)

HMAC Signing

const audit = new AuditLogger({
  filename: '/var/log/audit.log',
  hmacKey: process.env.AUDIT_HMAC_KEY, // prevents forgery
})

// Verify with the same key
const result = AuditVerifier.verify('/var/log/audit.log', {
  hmacKey: process.env.AUDIT_HMAC_KEY,
})

Audit Entry Format

{
  "type": "audit",
  "timestamp": "2026-05-28T14:00:00.000Z",
  "logger": "financial-system",
  "event": "USER_LOGIN",
  "actor": "[email protected]",
  "target": "system",
  "metadata": { "ip": "10.0.0.1" },
  "seq": 1,
  "prevHash": "0000000000000000000000000000000000000000000000000000000000000000",
  "hash": "a1b2c3..."
}

Each entry is chained to the previous via prevHash. Optional HMAC field prevents forgery. AuditVerifier checks hash chain integrity, sequence order, and HMAC signatures.

Remote Configuration (v3)

const { RemoteConfig } = require('logaste')

RemoteConfig.url('https://config.example.com/logging.json', {
  pollInterval: 30000,
  loggers: [log],
}).start()

Sources: HTTP endpoint, local file, or custom async function.

Log Levels

trace(10) → debug(20) → info(30) → warn(40) → error(50) → fatal(60)

log.setLevel('debug')
log.isEnabled('warn')
log.log('warn', 'dynamic level')

Context & Child Loggers

log.withContext({ requestId: 'abc' })
const child = log.child({ userId: 42 })

Sampling

log.setSampler('debug', Sampler.rate(0.1))
log.setSampler('trace', Sampler.random(0.05))
log.setSampler('info', Sampler.hash(0.2))

Transports

| Transport | Description | |-----------|-------------| | ConsoleTransport | stdout/stderr, color, pretty-print | | FileTransport | file with size-based rotation | | HTTPTransport | POST to remote endpoint | | SyslogTransport | RFC 5424 over UDP/TCP |

API Reference

createLogger(options)

name, level, context, transports, formatter, batchSize, flushInterval, onError

Logger Methods

log(level, msg, meta?) · trace/debug/info/warn/error/fatal · child(fields) · setLevel(level) · setSampler(level, sampler) · isEnabled(level) · withContext(fields) · flush()

AuditLogger(options)

name · filename (or transport) · hmacKey · .audit(event, data) · .flush()

AuditVerifier.verify(filepath, options)

Returns { valid, entries, errors }

License

MIT