forked from mirrors/Scribe.js
Merge pull request #37 from guillaumewuip/fix-logFolder
Allow one log folder for multiple consoles
This commit is contained in:
commit
5c4e3b6c89
2 changed files with 18 additions and 7 deletions
18
examples/multiplesConsolesOneFolder.js
Normal file
18
examples/multiplesConsolesOneFolder.js
Normal file
|
@ -0,0 +1,18 @@
|
||||||
|
var scribe = require('../scribe.js')({
|
||||||
|
createDefaultConsole : false
|
||||||
|
});
|
||||||
|
|
||||||
|
var consoleOne = scribe.console({
|
||||||
|
logWriter : {
|
||||||
|
rootPath : "testLogs"
|
||||||
|
}
|
||||||
|
});
|
||||||
|
var consoleTwo = scribe.console({
|
||||||
|
logWriter : {
|
||||||
|
rootPath : "testLogs"
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
//both will log in /testLogs
|
||||||
|
consoleOne.log("Hello one");
|
||||||
|
consoleOne.log("Hello two");
|
|
@ -31,13 +31,6 @@
|
||||||
|
|
||||||
this.rootPath = rootPath || 'logs';
|
this.rootPath = rootPath || 'logs';
|
||||||
|
|
||||||
//Check if the folder is already in use
|
|
||||||
if (rootPaths.indexOf(this.rootPath) > -1) {
|
|
||||||
throw new Error('Folder ' + this.rootPath + ' already in use');
|
|
||||||
} else {
|
|
||||||
rootPaths.push(this.rootPath);
|
|
||||||
}
|
|
||||||
|
|
||||||
//Init history
|
//Init history
|
||||||
this.initHistory();
|
this.initHistory();
|
||||||
};
|
};
|
||||||
|
|
Loading…
Add table
Reference in a new issue