logstalgia now has its own output format, rather than being the default
This commit is contained in:
@ -22,7 +22,7 @@ $ npm install -g local-web-server
|
||||
Usage
|
||||
-----
|
||||
```
|
||||
$ ws [--directory|-d <directory>] [--port|-p <port>] [--log-format|-f dev|default|short|tiny] [--compress|-c]
|
||||
$ ws [--directory|-d <directory>] [--port|-p <port>] [--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 -
|
||||
```
|
||||
|
||||

|
||||
|
22
bin/ws.js
22
bin/ws.js
@ -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();
|
||||
|
Reference in New Issue
Block a user