Learn about our RFC process, Open RFC meetings & more.Join in the discussion! »


1.0.3 • Public • Published


NPM version Build Status Coverage Status semantic-release Greenkeeper badge

What is it?

This is a format for console logging for winston > 3.x.x. It's based loosely on bunyan-debug-stream.


import winston from 'winston';
import debugFormat from 'winston-format-debug';
const logger = winston.createLogger({
    levels: winston.config.syslog.levels,
    level: 'info',
    transports: [
        new winston.transports.Console({
            format: winston.format.combine(
                    levels: winston.config.syslog.levels,
                    colors: winston.config.syslog.colors



The name of the process. If not specified, winston-format-debugger will attempt to figure this out from process.argv.


A hash where keys are level names, and values are level numbers. This is the same levels you pass to winston.createLogger({levels}). If not specified, defaults to winston.config.npm.levels.


Colors to use to colorize things. You can also set colors to false to disable all colors. If not specified, defaults to winston.config.npm.colors.

colorizePrefix, colorizeMessage, colorizeValues

winston-format-debug logs a message that looks something like this:

Jun 28 20:55:16 process[7998] INFO: Hello world
    otherValue: "hello"

colorizePrefix controls whether or not the date, process name, and PID are colorized (defaults to false). colorizeMessage controls the text of the message (defaults to true). colorizeValues controls wether non-message values are colorized (defaults to true).

These options are all ignored unless the colors option is passed in.


This is the root of your project. This is used to strip prefixes from filenames, in stack traces, and to decide which files are part of "your code" and which are not.


The maximum number of lines to show in a stack trace. If not specified, defaults to unlimited.


The maximum width to print for values (other than message).

Any "extra values" in the info object from winston will be printed, but each (aside from errors) are truncated to a single line. If specified, this is the width to truncate to. In a TTY, defaults to process.stdout.columns. Otherwise, defaults to 80.

Special fields

  • level, message - Defined by winston.
  • @timestamp - If present, this will be ignored.
  • name - Assumed to be the logger name. This will be printed along with the process name.

Prefixers and Stringifiers

bunyan-debug-stream has support for "prefixers" and "stringifiers" which can be used to customize the log output. These are not required in Winston, though, as you can easily write a format which edits your data. For example, if you had an accountName field, you could do the same as a prefixer with:

import winston from 'winston';
const accountPrefixer = winston.format(info => {
    info.message = `[${info.account}${info.message}`;
    return info;
const logger = winston.createLogger({
    transports: [
        new winston.transports.Console({
            format: winston.format.combine(


npm i winston-format-debug

DownloadsWeekly Downloads






Unpacked Size

21.8 kB

Total Files


Last publish


  • avatar