From ca54d1fe0cafeb8b6d4f6cad995ab2abfd5cb619 Mon Sep 17 00:00:00 2001 From: Neamar Date: Thu, 20 Nov 2014 18:58:13 +0100 Subject: [PATCH] Added documentation for -o and --template --- bin/bunyan | 10 +++++++++- package.json | 14 ++++---------- 2 files changed, 13 insertions(+), 11 deletions(-) diff --git a/bin/bunyan b/bin/bunyan index aec20d8d..f568fdd7 100755 --- a/bin/bunyan +++ b/bin/bunyan @@ -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(''); @@ -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); diff --git a/package.json b/package.json index 704ccabf..838dbc2f 100644 --- a/package.json +++ b/package.json @@ -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", @@ -35,6 +28,7 @@ "verror": "1.3.3", "vasync": "1.4.3" }, + "scripts": { "test": "make test" }