Ability to pass in multiple arguments to logging calls?
See original GitHub issue@pigmej ran into an issue today in the IRC
var winston = require('winston');
winston.log('info', 'Hello distributed log files!', {"foo":"bar"}, ['123', '456']);
node.js:134
throw e; // process.nextTick error, or 'error' event on first tick
^
TypeError: object is not a function
at Array.CALL_NON_FUNCTION (native)
at /usr/local/lib/node/.npm/winston/0.2.7/package/lib/winston/logger.js:107:42
at [object Object].log (/usr/local/lib/node/.npm/winston/0.2.7/package/lib/winston/transports/console.js:46:3)
at [object Object].log (/usr/local/lib/node/.npm/winston/0.2.7/package/lib/winston/logger.js:102:17)
at Object.log (/usr/local/lib/node/.npm/winston/0.2.7/package/lib/winston.js:53:34)
at Object.<anonymous> (/Users/maraksquires/dev/winston/test.js:3:9)
at Module._compile (module.js:404:26)
at Object..js (module.js:410:10)
at Module.load (module.js:336:31)
at Function._load (module.js:297:12)
I’m assuming this is a simple fix. What do you think indexzero?
Issue Analytics
- State:
- Created 12 years ago
- Reactions:4
- Comments:10 (4 by maintainers)
Top Results From Across the Web
Passing multiple arguments to console.log - Stack Overflow
If you want to be able to pass an arbitrary number of arguments into console.log , I would suggest using the arguments variable....
Read more >logging — Logging facility for Python — Python 3.11.1 ...
Multiple calls to getLogger() with the same name will always return a reference to the ... The fourth keyword argument is extra which...
Read more >Python Logging Basics - The Ultimate Guide To Logging
Python Logging Basics. This article covers the basics of using the standard logging module that ships with all Python distributions.
Read more >Python Logging: A Stroll Through the Source Code
The Logger takes the LogRecord and passes it off to the Handler , but only if the effective level of the LogRecord is...
Read more >Java static code analysis - SonarSource Rules
Similarly, passing concatenated strings into a logging method can also incur a needless performance hit because the concatenation will be performed every time ......
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
I would suggest using ES2015 template literals. For example:
Notice I used back ticks
`
instead of quotes'
to wrap my string.@indexzero - The issue is that there is a disconnect between winston’s logging method and the standard
console.log
which many developers are use to using.It’s pretty standard in JS land to do something like:
I think it’s pretty reasonable to emulate this API. There is already code out there for doing the arguments parsing. I would think all we have to do is determine if the last method is a FN or not, if it is, then thats the callback.