Permalink
Browse files

Added logger

  • Loading branch information...
1 parent 45a92a3 commit fe449461dca42a76c17c6955ca502a5a802bb385 @ixti ixti committed May 9, 2012
Showing with 23 additions and 3 deletions.
  1. +19 −0 fontomas.js
  2. +2 −2 lib/stats.js
  3. +2 −1 package.json
View
@@ -15,6 +15,25 @@ var app = NLib.Application.create({
});
+process.on('uncaughtException', function (err) {
+ nodeca.logger.warn('Uncaught exception');
+ nodeca.logger.error(err);
+});
+
+
+// temporary fix for logger
+nodeca.hooks.init.before('bundles', function (next) {
+ var log4js = require('log4js');
+
+ log4js.addAppender(log4js.fileAppender(require('path').join(
+ nodeca.runtime.apps[0].root, 'log', nodeca.runtime.env + '.log'
+ )));
+
+ nodeca.logger = log4js.getLogger();
+ next();
+});
+
+
// preset version
nodeca.hooks.init.before('bundles', function (next) {
nodeca.runtime.version = require('./package.json').version;
View
@@ -39,12 +39,12 @@ module.exports.push = function (stats) {
var parts = [];
try {
- parts.push(parseInt(Date.now() / 1000, 10));
+ parts.push((new Date).toISOString());
parts.push(stats.user);
parts.push(stats.glyphs);
parts.push(stats.time);
- logger.write(parts.join(' ') + "\n");
+ logger.write(parts.join('\t') + "\n");
} catch (err) {
nodeca.logger.warn("Failed write stat results");
nodeca.logger.error(err);
View
@@ -29,7 +29,8 @@
"csso" : "1.2.12",
"socket.io" : "0.9.6",
"jade" : "0.26.0",
- "neuron" : "0.4.5"
+ "neuron" : "0.4.5",
+ "log4js" : "0.4.3"
},
"engines" : { "node": ">= 0.6.0" }
}

0 comments on commit fe44946

Please sign in to comment.