node.js - Winston doesn't pretty-print to console -
i'm trying winston pretty print console, stuck in file , ran node:
var winston = require('winston'); winston.cli(); winston.data({ a: "test", of: "many", properties: { like: "this" } }); winston.data('data', { a: "test", of: "many", properties: { like: "this" } });
the terminal spit following (not pretty) messages:
data: a=test, of=many, like=this data: data a=test, of=many, like=this
i'm following instructions on winston readme ("using winston in cli tool"). misreading something? missing setting somewhere?
i figured out answer (the documentation incorrect). if use constructor, , manually add transports, can set options, both winston, , individual transports. options need added winston directly, while others need added transport.
e.g.:
var winston = require('winston'); var logger = new (winston.logger)({ levels: { trace: 0, input: 1, verbose: 2, prompt: 3, debug: 4, info: 5, data: 6, help: 7, warn: 8, error: 9 }, colors: { trace: 'magenta', input: 'grey', verbose: 'cyan', prompt: 'grey', debug: 'blue', info: 'green', data: 'grey', help: 'cyan', warn: 'yellow', error: 'red' } }); logger.add(winston.transports.console, { level: 'trace', prettyprint: true, colorize: true, silent: false, timestamp: false }); logger.add(winston.transports.file, { prettyprint: false, level: 'info', silent: false, colorize: true, timestamp: true, filename: './nkindler.log', maxsize: 40000, maxfiles: 10, json: false });
Comments
Post a Comment