summaryrefslogtreecommitdiff
path: root/main.js
diff options
context:
space:
mode:
authorBenjamin Kiessling <mittagessen@l.unchti.me>2012-03-02 23:34:04 +0100
committerBenjamin Kiessling <mittagessen@l.unchti.me>2012-03-02 23:34:04 +0100
commit68d2362666f7349636bc597e203e278e7b5d4a1a (patch)
treecc319f6753fd6f6eb9e306839ba8049bf8f33ff6 /main.js
parentd45d56dfebe29b55ee1ee00b2f31e371134bc8a5 (diff)
Add new logging module
Diffstat (limited to 'main.js')
-rwxr-xr-xmain.js14
1 files changed, 8 insertions, 6 deletions
diff --git a/main.js b/main.js
index 4b25c4e..1f26faa 100755
--- a/main.js
+++ b/main.js
@@ -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);