Skip to content

koenig-dominik/winston-humanize-formatter

Repository files navigation

Winston humanize formatter

Format winston logging in a human readable format

Install

npm install winston-humanize-formatter

Usage

You can either use the formatters directly or use one of the presets

import { transports, createLogger } from 'winston';
import { presets } from 'winston-humanize-formatter';

createLogger({
  level: 'debug',
  format: presets.cli.dev,
  transports: [
    new transports.Console()
  ]
});

available presets

import { presets } from 'winston-humanize-formatter';

presets.cli.dev;
presets.cli.prod;

available formatters

import { formatter } from 'winston-humanize-formatter';

formatter.colorize({ keys: string[] });
formatter.join({ keys: string[] });
formatter.multiline({ keys: string[] });
formatter.padLevels({ keys: string[] });
formatter.prettyJson({ excludeKeys: string[], colorize?: boolean, depth?: number });
formatter.stacks({ cleanStackPaths: boolean });

Examples

Preset cli dev CLI dev example

Releases

No releases published

Packages

No packages published