mirror of
https://github.com/seejohnrun/haste-server.git
synced 2025-12-13 01:05:55 +00:00
Logger configuration
This commit is contained in:
16
server.js
16
server.js
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user