Transport Formatter not called/used.
See original GitHub issueThis might be more of a question than an ‘issue’. I am trying to use a custom formatter with a logging transport. It seems that the formatter function is ignored in my simple test. I’ve taken and slightly modified the example from the README:
'use strict';
var winston = require('winston');
var logger = new (winston.Logger)({
transports: [
new (winston.transports.Console)({
timestamp: function() {
return Date.now();
},
formatter: function(options) {
// Return string will be passed to logger.
return 'MEOW!';
}
})
]
});
logger.info('Data to log.');
I am expecting the output (to stdout in this case) to be: “MEOW” Instead the output is:“1422632922024 - info: Data to log.” Which, I believe, is the default. Am I missing something?
Thanks!
Issue Analytics
- State:
- Created 9 years ago
- Comments:11 (2 by maintainers)
Top Results From Across the Web
How to Log Full Stack Trace with Winston 3?
For winston version 3.2.0+ , following will add stacktrace to log output: import { createLogger, format, transports } from 'winston'; ...
Read more >How to Comply with Federal Hazardous Materials Regulations
This document provides only a general overview of the requirements for transporting hazardous materials by highway.
Read more >JSON - Wikipedia
JSON is an open standard file format and data interchange format that uses human-readable text to store and transmit data objects consisting of ......
Read more >Logging with Winston and Node.js - Section.io
This article explain logging within the context of Winston. Winston processes your app activities and generate useful information into a log ...
Read more >logging in JavaScript with Winston.js - ZetCode
format, winston.format.json, the format of log messages. transports, no transports, set of logging destinations for log messages.
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Just ran into this and came up with a work around that worked out for me.
@calebbrewer try this?