Commit 0fe0306c authored by John Crepezzi's avatar John Crepezzi
Browse files

Logger configuration

parent a6bd69f2
Loading
Loading
Loading
Loading
+9 −1
Original line number Diff line number Diff line
@@ -3,6 +3,14 @@
  "host": "localhost",
  "port": 7777,

  "keyLength": 6
  "keyLength": 6,

  "logging": [
    {
      "level": "verbose",
      "type": "Console",
      "colorize": true
    }
  ]

}
+13 −3
Original line number Diff line number Diff line
@@ -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
// Set up the logger
if (config.logging) {
  try {
    winston.remove(winston.transports.Console);
winston.add(winston.transports.Console, { colorize: true, level: 'verbose' });
  } 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