npm.io
0.1.4 • Published 6 years ago

winston-humanize-formatter

Licence
MIT
Version
0.1.4
Deps
1
Size
72 kB
Vulns
0
Weekly
0

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

Keywords