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

@pauloferreira25/aws-lambda-logger

v0.1.2

Published

Structured console.log logger for AWS Lambda, with AsyncLocalStorage-based correlation id propagation.

Downloads

243

Readme

@pauloferreira25/aws-lambda-logger

Structured, console.log-based logger built for AWS Lambda — no worker threads, no transport machinery that doesn't survive a frozen execution environment. Correlation id propagation via AsyncLocalStorage, so every log line inside a request carries it automatically, with no need to thread it through every function call by hand.

Why not pino

pino's default transport (thread-stream) runs on a worker thread. That model fits a long-running server; it doesn't fit Lambda, where the execution environment can be frozen or torn down between invocations and CloudWatch already captures stdout directly. This package writes one JSON line per log call, synchronously, with no background thread.

Install

npm install @pauloferreira25/aws-lambda-logger

Usage

import { makeLogger, runWithCorrelationId } from '@pauloferreira25/aws-lambda-logger'

const log = makeLogger({ config: { level: 'debug' } })

export const handler = (event, context) =>
  runWithCorrelationId({
    correlationId: context.awsRequestId,
    run: async () => {
      log.debug({ context: { event }, message: 'handler' })
      // every log call inside this run — including ones made deep inside
      // repository/service functions built at module load time — carries
      // the same correlationId automatically.
    },
  })

OpenTelemetry trace correlation

Every log line automatically includes traceId and spanId when an OpenTelemetry span is active — no wiring required beyond having the application's own OTel setup in place (e.g. the AWS Distro for OpenTelemetry Lambda layer, or a manually configured SDK). This package only depends on @opentelemetry/api, the lightweight, side-effect-free API surface — it never registers a global tracer or context manager itself. If the application hasn't configured OpenTelemetry at all, traceId/spanId are simply omitted; nothing breaks.

correlationId and traceId/spanId serve different purposes and both can appear on the same line: correlationId identifies one Lambda invocation, traceId identifies a trace that may span multiple services.

API

  • makeLogger({ config: { level } }) — returns a Log with debug, info, warn, error, each taking { context, message }. Calls below the configured level are silently dropped.
  • runWithCorrelationId({ correlationId, run }) — runs run with correlationId bound for its entire async duration, including anything it awaits transitively. Concurrent calls never leak into each other.
  • getCorrelationId() — reads the correlationId bound by the nearest enclosing runWithCorrelationId, or undefined if none is active.
  • getOtelTraceContext() — reads { traceId, spanId } from the active OpenTelemetry span, or undefined if none is active or OpenTelemetry isn't configured.

License

Not yet decided — add a LICENSE file and the license field in package.json before publishing.