check for existence of destroySoon (does not exist in node v0.2.x)
This commit is contained in:
+11
-2
@@ -295,7 +295,12 @@ function fileAppender (file, layout, logSize, numBackups, filePollInterval) {
|
|||||||
//close the file on process exit.
|
//close the file on process exit.
|
||||||
process.on('exit', function() {
|
process.on('exit', function() {
|
||||||
logFile.end();
|
logFile.end();
|
||||||
logFile.destroySoon();
|
//node v0.2.x does not have destroySoon
|
||||||
|
if (logFile.destroySoon) {
|
||||||
|
logFile.destroySoon();
|
||||||
|
} else {
|
||||||
|
logFile.destroy();
|
||||||
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
return function(loggingEvent) {
|
return function(loggingEvent) {
|
||||||
@@ -321,7 +326,11 @@ function setupLogRolling (logFile, filename, logSize, numBackups, filePollInterv
|
|||||||
function rollThatLog (logFile, filename, numBackups) {
|
function rollThatLog (logFile, filename, numBackups) {
|
||||||
//first close the current one.
|
//first close the current one.
|
||||||
logFile.end();
|
logFile.end();
|
||||||
logFile.destroySoon();
|
if (logFile.destroySoon) {
|
||||||
|
logFile.destroySoon();
|
||||||
|
} else {
|
||||||
|
logFile.destroy();
|
||||||
|
}
|
||||||
//roll the backups (rename file.n-1 to file.n, where n <= numBackups)
|
//roll the backups (rename file.n-1 to file.n, where n <= numBackups)
|
||||||
for (var i=numBackups; i > 0; i--) {
|
for (var i=numBackups; i > 0; i--) {
|
||||||
if (i > 1) {
|
if (i > 1) {
|
||||||
|
|||||||
+1
-1
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "log4js",
|
"name": "log4js",
|
||||||
"version": "0.3.1",
|
"version": "0.3.3",
|
||||||
"description": "Port of Log4js to work with node.",
|
"description": "Port of Log4js to work with node.",
|
||||||
"keywords": [
|
"keywords": [
|
||||||
"logging",
|
"logging",
|
||||||
|
|||||||
Reference in New Issue
Block a user