Skip to content

Commit

Permalink
Adding prettyPrint parameter as function example.
Browse files Browse the repository at this point in the history
  • Loading branch information
pose committed Jan 25, 2015
1 parent 861dbfb commit 3872dfb
Showing 1 changed file with 18 additions and 0 deletions.
18 changes: 18 additions & 0 deletions examples/custom-pretty-print.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
var winston = require('../lib/winston');

function myPrettyPrint(obj) {
return JSON.stringify(obj)
.replace(/\{/g, '< wow ')
.replace(/\:/g, ' such ')
.replace(/\}/g, ' >');
}

var logger = new (winston.Logger)({
transports: [
new (winston.transports.Console)({ prettyPrint: myPrettyPrint }),
]
});

logger.info('Hello, this is a logging event with a custom pretty print', { 'foo': 'bar' });
logger.info('Hello, this is a logging event with a custom pretty print2', { 'foo': 'bar' });

0 comments on commit 3872dfb

Please sign in to comment.