logstalgia now has its own output format, rather than being the default

This commit is contained in:
Lloyd Brookes
2014-06-13 18:42:35 +01:00
parent 8249588350
commit 6c99257224
2 changed files with 14 additions and 14 deletions

View File

@ -19,7 +19,7 @@ var dope = require("console-dope"),
var usage =
"usage: \n\
$ ws [--directory|-d <dir>] [--port|-p <port>] [--log-format|-f dev|default|short|tiny] [--compress|-c]\n\
$ ws [--directory|-d <dir>] [--port|-p <port>] [--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();