Open alexilyaev opened 6 years ago
+1
The documentation is a bit superficial regarding winston.Format
and the provided examples such as this one do not result in the expected output.
PR would be welcome to update that example @respinha-ribeiro. Will take a look at this in depth and see what we can do to make the transition easier.
Also @alexilyaev – winston does support the multiple argument notation, it's simply not enabled by default because it is a performance hit and as such opt-in.
Use winston.format.splat()
.
@indexzero I can gladly post a PR but currently I'm unable to understand how to obtain the standard notation.
I tried adding winston.format.splat
I just get a weird message like the ones shown by @alexilyaev.
I was making the same comments (objects/arrays) aren't formatting the same in the Gitter chatroom. Seems that the previous options.meta isn't treated the same way. Would be great to understand the differences and how to fix moving forward.
+1
After maybe 2 hours of trying to obtain the same logging format in V3 as in the previous version, I have to say I have to downgrade. I like the custom formatter and format.combine and everything, but either
I just want logger.error("error"), logger.info(object), logger.info(array) and no hustle.
All of those features work. If you'd like to share a code sample along with your shade that would be much more constructive.
Edit: @nemozny literally every feature you could not get working has an example in the examples/ directory. Please read those and feel free to add any you feel should be there.
Please tell us about your environment:
winston
version?winston@2
winston@3
node -v
outputs: v10.4.1What is the problem?
I've followed the upgrade to 3.0 doc, and when I was done, my logs were broken.
V2 supported multiple arguments to log functions, and using common format options, pretty printed Objects/Arrays/Errors nicely.
So these logs worked in V2:
But in V3, multiple arguments are no longer supported, only
meta
is supported and only as an Object. Plus the equivalent formatters do not yield the same result.Even if I add the
simple
formatter, it's still not the same:What do you expect to happen instead?
message
are not pretty printedconsole.log
and really is much easier to use when you need to log a string and then an Object, etc. (specifically when using the Console transport).