diff options
author | Benjamin Kiessling <mittagessen@l.unchti.me> | 2012-03-02 23:34:04 +0100 |
---|---|---|
committer | Benjamin Kiessling <mittagessen@l.unchti.me> | 2012-03-02 23:34:04 +0100 |
commit | 68d2362666f7349636bc597e203e278e7b5d4a1a (patch) | |
tree | cc319f6753fd6f6eb9e306839ba8049bf8f33ff6 /main.js | |
parent | d45d56dfebe29b55ee1ee00b2f31e371134bc8a5 (diff) |
Add new logging module
Diffstat (limited to 'main.js')
-rwxr-xr-x | main.js | 14 |
1 files changed, 8 insertions, 6 deletions
@@ -1,5 +1,8 @@ #! /usr/bin/env node +var path = require('path'); +var logging = require('node-logging'); +var express = require('express'); var args = require('optimist') .usage('Usage: $0 -c configuration [-h]') .default('c', './config') @@ -12,23 +15,22 @@ if(args.h) { return; } -var path = require('path'); - process.on('uncaughtException', function(err) { console.error('uncaughtException: ' + (err.stack || err.message || err.toString())); }); process.chdir(__dirname); + var config = require('./config'); +logging.setLevel(config.logLevel || 'info'); -var express = require('express'); var app = express(); - -app.use(express.logger()); +app.use(logging.requestLogger); app.use(express.staticCache()); app.use(express.static(path.join(__dirname, config.Config.rootDir))); - config.Config.app = app; +config.Config.logger = logging; + var model = require('./model_' + config.modelBackend); model.start(config.Config); |