From 7309e153ce3bebdcec631ce89cba7d145e4efe2f Mon Sep 17 00:00:00 2001 From: Lloyd Brookes Date: Sun, 15 Jun 2014 19:43:35 +0100 Subject: [PATCH] added 'none' as a --log-format --- bin/ws.js | 28 ++++++++++++++++------------ 1 file changed, 16 insertions(+), 12 deletions(-) diff --git a/bin/ws.js b/bin/ws.js index 09765d3..9dc88f5 100755 --- a/bin/ws.js +++ b/bin/ws.js @@ -16,7 +16,7 @@ var dope = require("console-dope"), var usage = "usage: \n\ -$ ws [--directory|-d ] [--port|-p ] [--log-format|-f dev|default|short|tiny|logstalgia] [--compress|-c]\n\ +$ ws [--directory|-d ] [--port|-p ] [--log-format|-f node|dev|default|short|tiny|logstalgia] [--compress|-c]\n\ $ ws --config\n\ $ ws --help|-h"; @@ -78,17 +78,21 @@ if (argv.config){ /* log using --log-format (if supplied) */ if(argv["log-format"]) { - if (argv["log-format"] === "logstalgia"){ - /* customised logger :date token, purely to satisfy Logstalgia. */ - morgan.token("date", function(){ - var a = new Date(); - return (a.getDate() + "/" + a.getUTCMonth() + "/" + a.getFullYear() + ":" + a.toTimeString()) - .replace("GMT", "").replace(" (BST)", ""); - }); - argv["log-format"] = "default"; - } - - app.use(morgan(argv["log-format"])); + if (argv["log-format"] === "none"){ + // do nothing, no logging required + } else { + if (argv["log-format"] === "logstalgia"){ + /* customised logger :date token, purely to satisfy Logstalgia. */ + morgan.token("date", function(){ + var a = new Date(); + return (a.getDate() + "/" + a.getUTCMonth() + "/" + a.getFullYear() + ":" + a.toTimeString()) + .replace("GMT", "").replace(" (BST)", ""); + }); + argv["log-format"] = "default"; + } + + app.use(morgan(argv["log-format"])); + } /* if no specific `--log-format` required, pipe the default web log output into `log-stats`, which prints statistics to the console */