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 🙏

© 2025 – Pkg Stats / Ryan Hefner

ewl

v1.2.2

Published

EWL provides common defaults for logging in an express application using winston.

Downloads

82

Readme

EWL

License Current Version npm

EWL (express-winston-logger) provides common defaults for logging in an express application using winston. It is pre-configured with request tracing enabled and extends some of the features provided by express-winston, e.g. body blacklisting redaction.

Installation

yarn add ewl

Usage

import { Ewl } from 'ewl';

const ewl = new Ewl();
ewl.debug('This logs to the console by default.');

Basic Express Example

index.ts:

import { Application } from 'express';

import { ewl, initEwl } from './logger';

const app = express() as Application;
initEwl(app);

const port = 3000;
app.listen(port, () => {
  ewl.debug(`App: Listening on port ${port}!`);
});

logger/index.ts:

import { Application } from 'express';
import { Ewl, LogLevel } from 'ewl';

export let ewl: Ewl;

export function initEwl(app: Application): void {
  ewl = new Ewl({
    enableRequestLogging: true,
    environment: process.env.ENVIRONMENT || 'development',
    label: 'app',
    logLevel: (process.env.LOG_LEVEL as LogLevel) || 'error',
    useLogstashFormat: false,
    version: process.env.VERSION || 'unknown',
  });

  // Use context middleware to inject the request id.
  app.use(ewl.contextMiddleware);

  // Use request middleware to inject express metadata.
  app.use(ewl.requestMiddleware);
}

Basic NestJS Example

main.ts:

import { NestFactory } from '@nestjs/core';

import { Ewl, LogLevel } from 'ewl';

import { AppModule } from './app.module';

async function bootstrap() {
  const ewl = new Ewl({
    enableRequestLogging: true,
    environment: process.env.ENVIRONMENT || 'development',
    label: 'app',
    logLevel: (process.env.LOG_LEVEL as LogLevel) || 'error',
    useLogstashFormat: false,
    version: process.env.VERSION || 'unknown',
  });

  // Set the default NestJS logger, allowing EWL to be the proxy.
  const app = await NestFactory.create(AppModule, { logger: ewl });

  // Use context middleware to inject the request id.
  app.use(ewl.contextMiddleware);

  // Use request middleware to inject express metadata.
  app.use(ewl.requestMiddleware);

  ewl.debug('Starting application on localhost:3000');

  await app.listen(3000, 'localhost');
}

bootstrap();

Customizing express-winston Request Logger Middleware

const ewl = new Ewl({
  enableRequestLogging: false,
  requestLoggingOptions: {
    bodyBlacklist: ['accessToken', 'password', 'refreshToken'],
    colorize: true,
    expressFormat: true,
    headerBlacklist: ['cookie', 'token'],
    meta: true,
    metaField: 'express',
    requestWhitelist: ['body', 'headers', 'method', 'params', 'query', 'url'],
    responseWhitelist: ['body', 'headers', 'statusCode'],
    statusLevels: true,
  },
});

// Use request middleware to inject express metadata.
app.use(ewl.requestMiddleware);

License

MIT License

Contributing

Contributions are encouraged, please see further details below:

Pull Requests

Here are some basic rules to follow to ensure timely addition of your request:

  1. Match coding style (braces, spacing, etc.).
  2. If it is a feature, bugfix, or anything please only change the minimum amount of code required to satisfy the change.
  3. Please keep PR titles easy to read and descriptive of changes, this will make them easier to merge.
  4. Pull requests must be made against the main branch. Any other branch (unless specified by the maintainers) will get rejected.
  5. Check for existing issues first, before filing a new issue.