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

@huncyrus/simple-serverless-logger

v1.0.2

Published

Simple logger for serverless and tiny projects without large overhead but possibility to use adapters and other logger packages.

Readme

Simple Serverless Logger

GitHub release CI

Goal, reason

A simple TypeScript based logger that is easy to use with multiple serverless project but without overhead and features that rarely or never used.
Inspired by the PHP's PSR-3 LoggerInterface.

Features

  • Simple Logger Interface (easy to implement or extend)
  • TypeScript support
  • JavaScript support
  • Adapters to use with Pino, Winston or anything else
  • Logging level

Explaining logging level

API & methods

  setLevel(level: "silent"|"error"|"warn"|"info"|"log"|"debug"|"verbose")
  getLevel()
  setVerbose(boolean) → when true, uses util.inspect (depth ∞, showHidden)
  isVerbose()
  log/info/warn/error/debug/verbose(message?: unknown, ...context: unknown[])

Usage

Requirements

  • NodeJS 20+
  • Npm 6+

How to install

  npm i @huncyrus/simple-serverless-logger

ESM

  import { ConsoleLogger } from '@huncyrus/simple-serverless-logger';
  const myGlobalContext = [{ some: 'test' }];
  const logger = new ConsoleLogger({ useTimestamps: false }, myGlobalContext);
  logger.info("hello from JS", { pid: process.pid });

Note: The global context is optional.

CommonJS (require)

  const { ConsoleLogger } = require("@huncyrus/simple-serverless-logger");
  const myGlobalContext = [{ some: 'test' }];
  const logger = new ConsoleLogger(myGlobalContext).setLevel("debug").setVerbose(false);
  logger.debug("works in CJS too", [1, 2, 3]);

Usage example

Please visit the Examples directory.

  import { ConsoleLogger } from "@huncyrus/simple-serverless-logger";

  const logger = new ConsoleLogger()
    .setLevel("verbose")
    .setVerbose(true);

  logger.log("message");
  logger.info("info level of log");
  logger.verbose("some verbose stuff");

  const someArray = [1, { nested: { x: 1 } }];
  logger.debug("text example", "context1", 2323, someArray, [], {}, null);

Example output

  [2025-10-13T08:26:39.202Z] INFO  Hello

Logger options

  export interface ConsoleLoggerOptions {
    level?: LogLevel;
    useTimestamps?: boolean;
    console?: ConsoleLike;
    writeMethodInBracket?: boolean;
  }
Level

The log level indicates which level should be written by the logger. The levels are based on the RFC5424 but simplified.
Available levels:

  • Verbose (via node util in the ConsoleLogger)
  • Debug
  • Info
  • Log
  • Warn
  • Error

The error levels follows both the RFC and the NPM error level values:

| Level name | Value | |:----------:|:-----:| | error | 0 | | warn | 1 | | info | 2 | | log | 3 | | debug | 4 | | verbose | 5 |

Use Timestamp

The useTimestamp option (boolean) shall ensure the log has a timestamp (local timezone) added to the log line. Example:

  [2025-10-13T08:26:39.202Z] [INFO]  Hello

This option is false by default (The original goal was to log into CloudWatch or any Serverless "built-in" logging solution that usually have ingestion timestamp) but for local files and special log stream/queues the timestamp ensures the log time is preserved.

Console

Global console, to support adapters and custom implementations.

Write Method in Brackets

Old, server log style, simple boolean, false by default. If it is enabled, then the log level shall use a bracket:

  [2025-10-13T08:26:39.202Z] [INFO]  Hello

Note on verbose

The ConsoleLogger uses the Node util package inspect features to be able to fully log long and nested objects.

Testing

  npm run build
  npm run test
  npm run test:run

Test coverate via Vitest:

  npm run test:coverage

Tests via docker

  docker build -t simple-serverless-logger-tests .
  # or rebuild
  # docker build --no-cache -t simple-serverless-logger-tests .

Then run

  docker run --rm simple-serverless-logger-tests

Expected output:

$ docker run --rm simple-serverless-logger-tests

> @huncyrus/[email protected] build
> rimraf dist && npx tsc -p tsconfig.json && npx tsc -p tsconfig.cjs.json && node -e "require('node:fs').cpSync('cjs.package.json','dist/cjs/package.json')"


> @huncyrus/[email protected] test:run
> npx vitest run


 RUN  v3.2.4 /usr/src/app

 ✓ tests/unit/emptyAdapter.spec.ts (6 tests) 29ms
 ✓ tests/e2e/consoleLogger.e2e.spec.ts (2 tests) 47ms
 ✓ tests/unit/consoleLogger.spec.ts (8 tests) 38ms
 ✓ tests/integration/pinoAdapter.spec.ts (1 test) 10ms
 ✓ tests/integration/winstonAdapter.spec.ts (1 test) 16ms
 ✓ tests/unit/interfaceContract.spec.ts (1 test) 11ms

 Test Files  6 passed (6)
      Tests  19 passed (19)
   Start at  17:28:35
   Duration  2.54s (transform 973ms, setup 0ms, collect 1.67s, tests 152ms, environment 7ms, prepare 2.46s)

Roadmap, future features

  • [ ] More examples
  • [ ] Cleanup of the Readme file
  • [ ] Document properly the API/callables
  • [x] Document the log levels
  • [x] Document the logger options
  • [ ] Stream adapter
  • [ ] Sentry adapter
  • [ ] DataDog adapter
  • [ ] Redis adapter
  • [ ] ElasticMQ adapter
  • [ ] AWS CloudWatch adapter
  • [x] Add global context object to the costructor
  • [x] Add docker to run tests

Author

Author: Györk Bakonyi

Contribution

Contributing rules

References