From 68d2362666f7349636bc597e203e278e7b5d4a1a Mon Sep 17 00:00:00 2001 From: Benjamin Kiessling Date: Fri, 2 Mar 2012 23:34:04 +0100 Subject: Add new logging module --- main.js | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) (limited to 'main.js') 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); -- cgit v1.2.1