Skip to content

Commit

Permalink
Added documentation for -o and --template
Browse files Browse the repository at this point in the history
  • Loading branch information
Neamar committed Nov 20, 2014
1 parent f7f1952 commit ca54d1f
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 11 deletions.
10 changes: 9 additions & 1 deletion bin/bunyan
Original file line number Diff line number Diff line change
Expand Up @@ -228,6 +228,14 @@ function printHelp() {
p(' bunyan: 0 indented JSON, bunyan\'s native format');
p(' inspect: node.js `util.inspect` output');
p(' short: like "long", but more concise');
p(' custom: use custom template defined with --template');
p(' -t, --template TEMPLATE');
p(' Custom template (you need to set -o custom)');
p(' Let you define your own templates, using mustache-like syntax.');
p(' Keys from the current object will be the template free variable.');
p(' You can put arbitrary code between {{ }}.');
p(' Use _cS to start a color, and _cE to stop a color.');
p(' Example: {{ _cS(\'grey\') }}{{ req.username }}{{ _cE(\'grey\') }}');
p(' -j shortcut for `-o json`');
p(' -0 shortcut for `-o bunyan`');
p('');
Expand Down Expand Up @@ -1061,7 +1069,7 @@ function emitRecord(rec, line, opts, stylize) {
rec._cS = stylize.start;
// Shortcut for "colorEnd"
rec._cE = stylize.end;
emit(opts.template ? opts.template(rec) : 'No template defined. Use --template.' +'\n');
emit((opts.template ? opts.template(rec) : 'No template defined. Use --template.') + '\n');
break;
default:
throw new Error('unknown output mode: '+opts.outputMode);
Expand Down
14 changes: 4 additions & 10 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,20 +7,13 @@
"bin": {
"bunyan": "./bin/bunyan"
},

"repository": {
"type": "git",
"url": "git://github.com/trentm/node-bunyan.git"
},
"engines": [
"node >=0.8.0"
],
"keywords": [
"log",
"logging",
"log4j",
"json",
"bunyan"
],
"engines": ["node >=0.8.0"],
"keywords": ["log", "logging", "log4j", "json", "bunyan"],
"// comment1": "'dtrace-provider' required for dtrace features",
"// comment2": "'underscore' required for custom templating in Bunyan CLI",
"// comment3": "'mv' required for RotatingFileStream",
Expand All @@ -35,6 +28,7 @@
"verror": "1.3.3",
"vasync": "1.4.3"
},

"scripts": {
"test": "make test"
}
Expand Down

0 comments on commit ca54d1f

Please sign in to comment.