Skip to content
Browse files

using new logger that logs to s3 with proper configuration

  • Loading branch information...
1 parent 7aec7ed commit 3363b0e72fe19431a5c5f4e767001b13177298b9 Joachim Kainz committed Jul 14, 2012
Showing with 39 additions and 42 deletions.
  1. +1 −1 Jakefile.js
  2. +4 −0 lib/launcher.js
  3. +29 −35 lib/logger.js
  4. +5 −6 package.json
View
2 Jakefile.js
@@ -8,7 +8,7 @@
desc('Run tests');
task('test', [], function () {
- jake.exec(["./node_modules/.bin/vows --trace"], function () {
+ jake.exec(["./node_modules/.bin/vows --trace --spec"], function () {
console.log('All tests passed.');
complete();
}, {stdout: true});
View
4 lib/launcher.js
@@ -10,6 +10,7 @@
https = require('https'),
cluster = require('cluster'),
startSte = require("./site"),
+ logger = require("./logger"),
express = require("express"),
reporter = require("404project"),
Batch = require("batch"),
@@ -242,6 +243,9 @@
return cb(err);
}
+ logger.init(globalConfig);
+ logger("starting", globalConfig);
+
return loadSites(self.dir, function (err, sites, multiSite) {
if (err) {
return cb(err);
View
64 lib/logger.js
@@ -2,54 +2,48 @@
(function (module) {
"use strict";
- var winston = require('winston'),
+ var jlogger = require('jolira-logger'),
debug = process.env.NODE_DEBUG && /site-manager/.test(process.env.NODE_DEBUG),
util = require('util'),
- logger;
+ logger = jlogger({}),
+ proxy;
- function formatMessage() {
- var args = Array.prototype.slice.call(arguments),
- first = args.shift();
-
- args.unshift(new Date());
- args.unshift('[%s] ' + first);
-
- return util.format.apply(null, args);
- }
-
- logger = function () {
- winston.info(formatMessage.apply(this, arguments));
+ proxy = function () {
+ logger.info.apply(this, arguments);
};
- logger.isDebugging = debug;
- logger.winston = winston;
- logger.info = function () {
- winston.info(formatMessage.apply(this, arguments));
+ proxy.init = function(config) {
+ if (config["aws-logging"]) {
+ logger = jlogger(config);
+ }
+ };
+ proxy.isDebugging = debug;
+ proxy.info = function () {
+ logger.info.apply(this, arguments);
};
- logger.debug = function () {
+ proxy.debug = function () {
if (debug) {
- winston.log("debug", formatMessage.apply(this, arguments));
+ logger.debug.apply(this, arguments);
}
};
- logger.notice = function () {
- winston.log("info", formatMessage.apply(this, arguments));
+ proxy.notice = function () {
+ logger.notice.apply(this, arguments);
+ };
+ proxy.warning = function () {
+ logger.warning.apply(this, arguments);
};
- logger.warn =
- logger.warning = function () {
- winston.log("warning", formatMessage.apply(this, arguments));
- };
- logger.error = function () {
- winston.log("error", formatMessage.apply(this, arguments));
+ proxy.error = function () {
+ logger.error.apply(this, arguments);
};
- logger.crit = function () {
- winston.log("error", formatMessage.apply(this, arguments));
+ proxy.crit = function () {
+ logger.crit.apply(this, arguments);
};
- logger.alert = function () {
- winston.log("error", formatMessage.apply(this, arguments));
+ proxy.alert = function () {
+ logger.alert.apply(this, arguments);
};
- logger.emerg = function () {
- winston.log("error", formatMessage.apply(this, arguments));
+ proxy.emerg = function () {
+ logger.emerg.apply(this, arguments);
};
- return module.exports = logger;
+ return module.exports = proxy;
})(module);
View
11 package.json
@@ -4,21 +4,20 @@
"description":"Create & manage mobile & desktop sites using HTML5 & CSS3",
"keywords":["site", "html5"],
"contributors": [
- "Joachim Kainz <jfk@jolira.com> (http://www.jolira.com)",
- "Gabe Hopper <gabe@jolira.com> (http://www.jolira.com)"
+ "Joachim Kainz <jfk@jolira.com> (http://www.jolira.com)"
],
"repository":{
"url":"https://github.com/jolira/site-manager.git",
"type":"git"
},
"dependencies":{
- "connect-less-jolira":"*",
- "directory-tree-watcher":"*",
"handlebars":"*",
"404project":"*",
- "connect":">= 2.0.3",
+ "connect-less-jolira":"*",
+ "directory-tree-watcher":"*",
"express":">= 3.0.0alpha4",
- "winston": "*",
+ "connect":">= 2.0.3",
+ "jolira-logger": "*",
"batch":"*"
},
"bin": {

0 comments on commit 3363b0e

Please sign in to comment.
Something went wrong with that request. Please try again.