node-windows
node-windows copied to clipboard
EventLogger ignores source name defined in constructor
I'm using EventLogger for logging in my app, but all my logs have source set to "Node.js" instead of string which I defined in EventLogger constructor.
For example: var EventLogger = require('node-windows').EventLogger; var log = new EventLogger('TestLogger'); log.info('Test');
creates log in Windows Logs / Application with source "Node.js" instead of "TestLogger"
My Node.js version: 0.10.27, OS: Windows 8.1 x64
@DominikPalo This should work as a work-around:
var log = new EventLogger({source:'TestLogger'});
My messages source are set to "Unknown Application" even with the given workaround.
Code:
var log = new (require("node-windows").EventLogger)({source: "my app" });
log.info("test message");
nodejs: v12.7 os: Windows server 2008 R2 standard
Ignore my last statement. The given example works, the problem within my program (which is actually allot bigger than the given example) is with the wrapping of the log functions.
eg.
console.log = log.info;
will not work as expected because the info(...)
method needs information stored within the log
instance. A working solution would be:
console.log = log.info.bind(log);