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

@skutopia/logger

v4.0.0

Published

SKUtopia logger

Readme

SKUtopia Logger

SKUtopia Logger enables the tracing of requests across servers and throughout applications in Express.js. It enables this correlation by consuming the X-Request-Id if one exists, or generating a request id if one does not. It then provides a context-aware logger that can be invoked throughout the call-stack, appending the request id to the log message.

It is based on Winston and express-winston libraries and uses SumoLogic's preferred severity definitions.

Usage

Full example

import {
  configureAccessLoggingMiddleware,
  loggingContextCreatorMiddleware,
  logger
} from '@skutopia/logger';
import * as express from 'express';

const server = express();

server.use(loggingContextCreatorMiddleware);
server.use(configureAccessLoggingMiddleware({ ignoredRoutes: ['/livez', '/readyz'] }));

const doFunctionCall = () => {
  logger.info('This log will have the request id attached to it');
}

server.get('/', (req, res) => {
  doFunctionCall(); // No work required to attach the request id to nested log calls
  res.send('Hello World!');
});

Express.js access log

configureAccessLoggingMiddleware produces access logs from Express.js. This logging middleware must be loaded BEFORE the route handler to capture the request-response lifecycle.

import { configureAccessLoggingMiddleware } from '@skutopia/logger';
import * as express from 'express';

const app = express();

// The logging middleware goes before the route handler.
app.use(configureAccessLoggingMiddleware({ ignoredRoutes: ['/livez', '/readyz'] }));

app.get('/', (req, res) => {
  res.send('Hello World!');
  // Access logs for this route include the request id.
});

app.listen(3000);

Express.js error log for uncaught exceptions from route handlers

errorLoggingMiddleware produces contextualised error logs for uncaught errors in the route handlers from Express.js. This logging middleware must be loaded AFTER the route handler and before any custom error handlers which are directed with next(err) at the final stage of the request-response lifecycle.

import { errorLoggingMiddleware } from '@skutopia/logger';
import * as express from 'express';

const app = express();

app.use(router);
// The logging middleware goes after the route handler and before the custom error handler.
app.use(errorLoggingMiddleware);
app.use(customErrorHandler);

Logging with context

loggingContextCreatorMiddleware provides the context necessary for the context-aware logger. This logging middleware must be loaded BEFORE the route handler.

After the logging middleware is loaded, you can simply use logger from the @skutopia/logger package to log messages.

To load the middleware,

import { loggingContextCreatorMiddleware } from '@skutopia/logger';
import * as express from 'express';

const app = express();

app.use(loggingContextCreatorMiddleware);
app.use(router);

To get the context object from the request object and use the logger

import { logger } from '@skutopia/logger';

function myHandler(req: express.Request, res: express.Response) {
  logger.info('info message');
  logger.error('error message');
  logger.fatal('fatal message');
}

Logging without context

Always use logger even if you do not expect the log to occur during a request. logger automatically utilises a non-contextualised logger when a log context is not available. This ensures that code can be safely refactored and the context aware logger will adapt accordingly.

import { logger } from 'skutopia-logger';

logger.info('info message');
logger.error('error message');
logger.fatal('fatal message');

Pretty print

By default, the output is in JSON format. To print it in a human-readable format, set this environment variable. This is not recommended for Production

PRETTY_LOG_FORMAT=true

Contribution

Test

By default, the test Express.js server listens to port 8080. You can specify a different port by setting the environment variable PORT with

PORT=3000 npm run test

Commit guidelines

This repo uses husky and commitlint to enforce commit message. Please always use

npm run commit

to submit commit messages.

Publish guidelines

Go through the release process by doing the following:

npm run release

This will create a release and once merged to the main branch, publish it to NPM public repository.

API Reference

Please refer to the generated docs for the API reference.