windows-eventlog-reader
Advanced tools
Comparing version 1.0.1 to 1.0.2
@@ -16,3 +16,4 @@ | ||
else | ||
console.dir (event); | ||
if (event) | ||
console.dir (event); | ||
} | ||
@@ -19,0 +20,0 @@ |
35
index.js
@@ -71,3 +71,3 @@ | ||
} else { | ||
req.feedCb (patchEvent (event)); | ||
return req.feedCb (patchEvent (event)); | ||
} | ||
@@ -90,2 +90,4 @@ } | ||
req.doneCb (error); | ||
} else if (req.stop) { | ||
req.doneCb (); | ||
} else { | ||
@@ -99,3 +101,4 @@ me = this; | ||
req.lastRecordNumber = event.recordNumber; | ||
req.feedCb (patchEvent (event)); | ||
req.stop = req.feedCb (patchEvent (event)) || false; | ||
return req.stop; | ||
} | ||
@@ -118,16 +121,16 @@ } | ||
if (error || ! event) { | ||
if (! req.lastRecordNumber) { | ||
if (error) { | ||
if (error.event_log_file_changed) { | ||
var newError = new EventLogClearedError (error.message); | ||
req.cb (newError); | ||
} else { | ||
req.cb (error); | ||
} | ||
if (error) { | ||
if (error.event_log_file_changed) { | ||
var newError = new EventLogClearedError (error.message); | ||
req.cb (newError); | ||
} else { | ||
var me = this; | ||
setTimeout (function () { | ||
me.wrap.read (req.offset, tailCb.bind (me, req)); | ||
}, req.interval); | ||
req.cb (error); | ||
} | ||
} else if (req.stop) { | ||
return; | ||
} else if (! req.lastRecordNumber) { | ||
var me = this; | ||
setTimeout (function () { | ||
me.wrap.read (req.offset, tailCb.bind (me, req)); | ||
}, req.interval); | ||
} else { | ||
@@ -141,3 +144,4 @@ me = this; | ||
req.lastRecordNumber = event.recordNumber; | ||
req.cb (null, patchEvent (event)); | ||
req.stop = req.cb (null, patchEvent (event)) || false; | ||
return req.stop; | ||
} | ||
@@ -153,2 +157,3 @@ } | ||
offset: offset, | ||
stop: false, | ||
lastRecordNumber: 0, | ||
@@ -155,0 +160,0 @@ interval: interval, |
{ | ||
"name": "windows-eventlog-reader", | ||
"version": "1.0.1", | ||
"version": "1.0.2", | ||
"description": "Read windows event logs", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
@@ -238,2 +238,6 @@ | ||
If the `feedCallback` function returns a `true` value when called no more | ||
events will be read or passed to the `feedCallback` function, and the | ||
`doneCallback` will be called. | ||
Once the `doneCallback` function has been called the read is complete and | ||
@@ -287,2 +291,6 @@ the `feedCallback` function will no longer be called. | ||
If the `feedCallback` function returns a `true` value when called no more | ||
events will be read or passed to the `feedCallback` function, and the | ||
`doneCallback` will be called. | ||
Once the `doneCallback` function has been called all available events will | ||
@@ -336,2 +344,5 @@ have been read and the `feedCallback` function will no longer be called. | ||
If the `callback` function returns a `true` value when called no more events | ||
will be read, and the `callback` function will not be called again. | ||
The following example reads all events starting at offset 6,000, and then | ||
@@ -379,2 +390,9 @@ tails the Windows event log, calling the `cb` function as and when events | ||
## Version 1.0.2 - 01/07/2013 | ||
* Feed callback functions can return `true` to indicate an operation should | ||
stop feeding events | ||
* Silence some compilation warnings | ||
* Throw an exception when the event log name provided is not valid | ||
# Roadmap | ||
@@ -384,8 +402,3 @@ | ||
* Make `close()` operations non-blocking (line `open()`, `read()`, etc.) | ||
* Allow the `read()` and `readAll()` `feedCallbacks` to indicate reading | ||
should stop by returning some value (i.e. something like `true`) | ||
* Throw an exception when the event log name provided is not valid | ||
* Automatically re-open event logs when the `eventlog.EventLogClearedError` | ||
error is experienced | ||
* Implement example Windows Event Log Syslog Forwarder Windows Service | ||
@@ -392,0 +405,0 @@ Suggestions and requirements should be sent to <stephen.vickers.sv@gmail.com>. |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
37534
220
421