Restored the errorlog function, fixes a bug

This commit is contained in:
Peter 'Pita' Martischka 2011-05-19 22:22:12 +01:00
parent eadc8fcf3b
commit 42dfb31cf8

View file

@ -16,8 +16,6 @@
require('joose'); require('joose');
//var http = require('http')
//var url = require('url')
var socketio = require('socket.io') var socketio = require('socket.io')
var settings = require('./settings') var settings = require('./settings')
var db = require('./db') 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() function randomPadName()
{ {
var chars = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXTZabcdefghiklmnopqrstuvwxyz"; var chars = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXTZabcdefghiklmnopqrstuvwxyz";