Native win32 module to log messages to the Windows EventLog
Want to see pretty graphs? Log in now!
npm install windows-eventlog
|22||downloads in the last week|
|73||downloads in the last month|
|Version||1.0.1 last updated a year ago|
|Keywords||windows, services, log, logging, logger|
Windows Event Log Js
Native node.js module to log messages to the Windows Event Log.
$ npm install windows-eventlog
You need to have these two things installed in your system for now:
Initialize somewhere the logger like:
var EventLog = require('windows-eventlog').EventLog; var myeventlog = new EventLog("mySource"); myeventlog.log("a message");
And you will see this:
new EventLog(source[, logName])
This create an instance of the EventLog with the given source. You can optionally pass a logName, defaults to "Application".
If the source doesn't exist in the event log database it will be created with the givne log name.
This method will create an entry in the event log with the given message.
Optionally you can specify a logEntryType. The possible values for logEntryType are "Information", "Warning", "Error" and others two that you will never use :)
How it works
This module was built on c++/cli (.Net) and uses System.Diagnostics.EventLog.
In order to log events you need to run the application with an elevated account: ie administrator or system account. Windows services typically run under the system account, if you are looking on how to run node.js applications as a Windows Service have a look to WinSer.
- Use uv_queue_work to execute the writelog method in a different thread ( ? )
About win32 native modules
(The MIT License)
Copyright (c) 2012 Jose Romaniello <email@example.com>
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the 'Software'), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.