Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

log settings for shipyard bin

  • Loading branch information...
commit 5ea17c7f59e767120bd71b78e92d9529b08b22a6 1 parent f810cd9
@seanmonstar authored
Showing with 28 additions and 5 deletions.
  1. +23 −0 bin/shipyard
  2. +5 −5 scripts/server.js
View
23 bin/shipyard
@@ -4,6 +4,8 @@ var program = require('commander'),
fs = require('fs'),
env = require('../lib/shipyard/env'),
logging = require('../lib/shipyard/logging'),
+ logConfig = require('../lib/shipyard/logging/config'),
+ ConsoleHandler = require('../lib/shipyard/logging/ConsoleHandler'),
type = require('../lib/shipyard/utils/type'),
shipyard = require('../'),
builder = require('../scripts/build'),
@@ -12,6 +14,27 @@ var program = require('commander'),
shell = require('../scripts/shell').shell,
test = require('../scripts/test');
+logConfig({
+ 'formatters': {
+ 'default': {
+ 'format': '{name}.{levelname}: {message}'
+ }
+ },
+ 'handlers': {
+ 'console': {
+ 'class': ConsoleHandler,
+ 'formatter': 'default'
+ }
+ },
+ 'loggers': {
+ 'shipyard': {
+ 'handlers': ['console'],
+ 'level': 'DEBUG',
+ 'propagate': false
+ }
+ }
+});
+
var log = logging.getLogger('shipyard.bin');
var marked = false;
View
10 scripts/server.js
@@ -22,13 +22,13 @@ function serveFile(res, filename) {
e500(res, filename);
return;
}
- if (!stats.isFile()) {
+ if (!stats.isFile()) {
e404(res, filename);
return;
}
fs.readFile(filename, 'binary', function(err, contents) {
if (err) {
- e500(res, filename);
+ e500(res, filename, err);
return;
}
@@ -45,14 +45,14 @@ function serveFile(res, filename) {
}
function e404(res, filename) {
- log.warn("File not found: %s", filename);
+ log.warn("404 File not found: ", filename);
res.writeHead(404, HEADERS);
res.write('404 Not Found\n');
res.end();
}
-function e500(res, filename) {
- log.error("Error for file (%s): %s", filename, err);
+function e500(res, filename, err) {
+ log.error("500 Error for file ({0}): {1}", filename, err);
res.writeHead(500, HEADERS);
res.write(err + '\n');
res.end();
Please sign in to comment.
Something went wrong with that request. Please try again.