|
@ -19,7 +19,7 @@ var dope = require("console-dope"), |
|
|
|
|
|
|
|
|
var usage = |
|
|
var usage = |
|
|
"usage: \n\ |
|
|
"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 --config\n\ |
|
|
$ ws --help|-h"; |
|
|
$ ws --help|-h"; |
|
|
|
|
|
|
|
@ -48,7 +48,6 @@ try { |
|
|
{ name: "help", alias: "h", type: Boolean }, |
|
|
{ name: "help", alias: "h", type: Boolean }, |
|
|
{ name: "directory", alias: "d", type: String, value: process.cwd() }, |
|
|
{ name: "directory", alias: "d", type: String, value: process.cwd() }, |
|
|
{ name: "config", type: Boolean }, |
|
|
{ name: "config", type: Boolean }, |
|
|
{ name: "logstalgia", type: Boolean }, |
|
|
|
|
|
{ name: "compress", alias: "c", type: Boolean } |
|
|
{ name: "compress", alias: "c", type: Boolean } |
|
|
]).parse(); |
|
|
]).parse(); |
|
|
} catch(err){ |
|
|
} catch(err){ |
|
@ -56,15 +55,6 @@ try { |
|
|
} |
|
|
} |
|
|
argv = o.extend(storedConfig, argv); |
|
|
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){ |
|
|
if (argv.config){ |
|
|
dope.log("Stored config: "); |
|
|
dope.log("Stored config: "); |
|
|
dope.log(storedConfig); |
|
|
dope.log(storedConfig); |
|
@ -90,6 +80,16 @@ if (argv.config){ |
|
|
|
|
|
|
|
|
/* log using --log-format (if supplied) */ |
|
|
/* log using --log-format (if supplied) */ |
|
|
if(argv["log-format"]) { |
|
|
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"])); |
|
|
app.use(morgan(argv["log-format"])); |
|
|
} else { |
|
|
} else { |
|
|
var statStream = clf(); |
|
|
var statStream = clf(); |
|
|