From 6c99257224e74111d410f2c2c048ae7e4f1e68b8 Mon Sep 17 00:00:00 2001 From: Lloyd Brookes Date: Fri, 13 Jun 2014 18:42:35 +0100 Subject: [PATCH] logstalgia now has its own output format, rather than being the default --- README.md | 6 +++--- bin/ws.js | 22 +++++++++++----------- 2 files changed, 14 insertions(+), 14 deletions(-) diff --git a/README.md b/README.md index cc4948d..cf5cdf0 100644 --- a/README.md +++ b/README.md @@ -22,7 +22,7 @@ $ npm install -g local-web-server Usage ----- ``` -$ ws [--directory|-d ] [--port|-p ] [--log-format|-f dev|default|short|tiny] [--compress|-c] +$ ws [--directory|-d ] [--port|-p ] [--log-format|-f dev|default|short|tiny|logstalgia] [--compress|-c] $ ws --config $ ws --help|-h ``` @@ -103,9 +103,9 @@ $ brew install logstalgia Alternatively, [download a release for your system from github](https://github.com/acaudwell/Logstalgia/releases/latest). -Then pipe the `default` output directly into logstalgia for real-time visualisation: +Then pipe the `logstalgia` output format directly into logstalgia for real-time visualisation: ```sh -$ ws -f default | logstalgia - +$ ws -f logstalgia | logstalgia - ``` ![local-web-server with logstalgia](http://75lb.github.io/local-web-server/logstagia.gif) diff --git a/bin/ws.js b/bin/ws.js index bbcc2df..34229f2 100755 --- a/bin/ws.js +++ b/bin/ws.js @@ -19,7 +19,7 @@ var dope = require("console-dope"), var usage = "usage: \n\ -$ ws [--directory|-d ] [--port|-p ] [--log-format|-f dev|default|short|tiny] [--compress|-c]\n\ +$ ws [--directory|-d ] [--port|-p ] [--log-format|-f dev|default|short|tiny|logstalgia] [--compress|-c]\n\ $ ws --config\n\ $ ws --help|-h"; @@ -48,7 +48,6 @@ try { { name: "help", alias: "h", type: Boolean }, { name: "directory", alias: "d", type: String, value: process.cwd() }, { name: "config", type: Boolean }, - { name: "logstalgia", type: Boolean }, { name: "compress", alias: "c", type: Boolean } ]).parse(); } catch(err){ @@ -56,15 +55,6 @@ try { } argv = o.extend(storedConfig, argv); -if (argv.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)", ""); - }); -} - if (argv.config){ dope.log("Stored config: "); dope.log(storedConfig); @@ -90,6 +80,16 @@ 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"])); } else { var statStream = clf();