From 42dfb31cf87e3ec5c60955937b98f7ca298db376 Mon Sep 17 00:00:00 2001 From: Peter 'Pita' Martischka Date: Thu, 19 May 2011 22:22:12 +0100 Subject: [PATCH] Restored the errorlog function, fixes a bug --- node/server.js | 20 ++++++++++++++++++-- 1 file changed, 18 insertions(+), 2 deletions(-) diff --git a/node/server.js b/node/server.js index dd03c4359..d073756ce 100644 --- a/node/server.js +++ b/node/server.js @@ -16,8 +16,6 @@ require('joose'); -//var http = require('http') -//var url = require('url') var socketio = require('socket.io') var settings = require('./settings') var db = require('./db') @@ -120,6 +118,24 @@ async.waterfall([ } ]); +function errorlog(e) +{ + var timeStr = new Date().toUTCString() + ": "; + + if(typeof e == "string") + { + console.error(timeStr + e); + } + else if(e.stack != null) + { + console.error(timeStr + e.stack); + } + else + { + console.error(timeStr + JSON.stringify(e)); + } +} + function randomPadName() { var chars = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXTZabcdefghiklmnopqrstuvwxyz";