You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Previously with winston@2 I was doing like this: log.debug.apply(this, ['lisa-plugin-hue', 'preferences', {}]) but now with the v3 it gave me this:
TypeError: self.log is not a function
at Object.DerivedLogger.(anonymous function) (/Users/jaumard/IdeaProjects/lisa-box/node_modules/winston/lib/winston/create-logger.js:95:19)
at Object.<anonymous> (/Users/jaumard/IdeaProjects/lisa-box/test.js:15:11)
at Module._compile (internal/modules/cjs/loader.js:701:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:712:10)
at Module.load (internal/modules/cjs/loader.js:600:32)
at tryModuleLoad (internal/modules/cjs/loader.js:539:12)
at Function.Module._load (internal/modules/cjs/loader.js:531:3)
at Function.Module.runMain (internal/modules/cjs/loader.js:754:12)
at startup (internal/bootstrap/node.js:283:19)
at bootstrapNodeJSCore (internal/bootstrap/node.js:622:3)
Logger functions aren't bound to the logger object, so in that example you would need to change log.debug.apply(this, ...) to log.debug.apply(log, ...) so that the function is executed with the correct this or self variable.
Please tell us about your environment:
winston
version?winston@2
winston@3
node -v
outputs: v10.15.3What is the problem?
Previously with winston@2 I was doing like this:
log.debug.apply(this, ['lisa-plugin-hue', 'preferences', {}])
but now with the v3 it gave me this:Here is how to reproduce:
What do you expect to happen instead?
Have the log and no crash :)
Other information
Maybe I need to adapt my code now if it doesn't work the same way as v2 ?
The text was updated successfully, but these errors were encountered: