1
0
Fork 0
mirror of https://github.com/seejohnrun/haste-server.git synced 2024-11-21 20:31:20 +00:00

Logger configuration

This commit is contained in:
John Crepezzi 2011-11-18 17:26:25 -05:00
parent a6bd69f20a
commit 0fe0306caa
2 changed files with 22 additions and 4 deletions

View file

@ -3,6 +3,14 @@
"host": "localhost",
"port": 7777,
"keyLength": 6
"keyLength": 6,
"logging": [
{
"level": "verbose",
"type": "Console",
"colorize": true
}
]
}

View file

@ -12,9 +12,19 @@ var config = JSON.parse(fs.readFileSync('config.js', 'utf8'));
config.port = config.port || 7777;
config.host = config.host || 'localhost';
// Configure logging - TODO make configurable
winston.remove(winston.transports.Console);
winston.add(winston.transports.Console, { colorize: true, level: 'verbose' });
// Set up the logger
if (config.logging) {
try {
winston.remove(winston.transports.Console);
} catch(er) { }
var detail, type;
for (var i = 0; i < config.logging.length; i++) {
detail = config.logging[i];
type = detail.type;
delete detail.type;
winston.add(winston.transports[type], detail);
}
}
// TODO preparse static instead of using exists
// TODO implement command line