diff --git a/bin/bunyan b/bin/bunyan index 178f493..af4ff3d 100755 --- a/bin/bunyan +++ b/bin/bunyan @@ -26,12 +26,6 @@ var assert = require('assert'); var exeunt = require('exeunt'); -try { - var moment = require('moment'); -} catch (e) { - moment = null; -} - //---- globals and constants @@ -97,16 +91,6 @@ Object.keys(levelFromName).forEach(function (name) { var TIME_UTC = 1; // the default, bunyan's native format var TIME_LOCAL = 2; -// Timezone formats: output format -> momentjs format string -var TIMEZONE_UTC_FORMATS = { - long: '[[]YYYY-MM-DD[T]HH:mm:ss.SSS[Z][]]', - short: 'HH:mm:ss.SSS[Z]' -}; -var TIMEZONE_LOCAL_FORMATS = { - long: '[[]YYYY-MM-DD[T]HH:mm:ss.SSSZ[]]', - short: 'HH:mm:ss.SSS' -}; - // Boolean set to true when we are in the process of exiting. We don't always // hard-exit (e.g. when staying alive while the pager completes). @@ -258,8 +242,6 @@ function printHelp() { p(' simple: level, followed by "-" and then the message'); p(' -j shortcut for `-o json`'); p(' -0 shortcut for `-o bunyan`'); - p(' -L, --time local'); - p(' Display time field in local time, rather than UTC.'); p(''); p('Environment Variables:'); p(' BUNYAN_NO_COLOR Set to a non-empty value to force no output '); @@ -523,26 +505,12 @@ function parseArgv(argv) { case '-0': parsed.outputMode = OM_BUNYAN; break; - case '-L': - parsed.timeFormat = TIME_LOCAL; - if (!moment) { - throw new Error( - 'could not find moment package required for "-L"'); - } - break; case '--time': var timeArg = args.shift(); switch (timeArg) { case 'utc': parsed.timeFormat = TIME_UTC; break - case 'local': - parsed.timeFormat = TIME_LOCAL; - if (!moment) { - throw new Error('could not find moment package ' - + 'required for "--time=local"'); - } - break case undefined: throw new Error('missing argument to "--time"'); default: @@ -795,24 +763,8 @@ function emitRecord(rec, line, opts, stylize) { // Fast default path: We assume the raw `rec.time` is a UTC time // in ISO 8601 format (per spec). time = '[' + rec.time + ']'; - } else if (!moment && opts.timeFormat === TIME_UTC) { - // Don't require momentjs install, as long as not using TIME_LOCAL. + } else if (opts.timeFormat === TIME_UTC) { time = rec.time.substr(11); - } else { - var tzFormat; - var moTime = moment(rec.time); - switch (opts.timeFormat) { - case TIME_UTC: - tzFormat = TIMEZONE_UTC_FORMATS[short ? 'short' : 'long']; - moTime.utc(); - break; - case TIME_LOCAL: - tzFormat = TIMEZONE_LOCAL_FORMATS[short ? 'short' : 'long']; - break; - default: - throw new Error('unexpected timeFormat: ' + opts.timeFormat); - }; - time = moTime.format(tzFormat); } time = stylize(time, 'none'); delete rec.time; diff --git a/docs/bunyan.1 b/docs/bunyan.1 index 41d3769..d0ed132 100644 --- a/docs/bunyan.1 +++ b/docs/bunyan.1 @@ -142,10 +142,6 @@ Specify an output format\. One of \fBlong\fR (the default), \fBshort\fR, \fBjson \fB\-j\fR Shortcut for \fB\-o json\fR\. . -.TP -\fB\-L\fR, \fB\-\-time local\fR -Display the time field in \fIlocal\fR time, rather than the default UTC time\. -. .SH "LOG LEVELS" In Bunyan log records, then \fBlevel\fR field is a number\. For the \fB\-l|\-\-level\fR argument the level \fBnames\fR are supported as shortcuts\. In \fB\-c|\-\-condition\fR scripts, uppercase symbols like "DEBUG" are defined for convenience\. . diff --git a/docs/bunyan.1.html b/docs/bunyan.1.html index c11eaf0..617aec9 100644 --- a/docs/bunyan.1.html +++ b/docs/bunyan.1.html @@ -182,8 +182,6 @@ non-Bunyan lines are passed through.
-o FORMAT
, --output FORMAT
Specify an output format. One of long
(the default), short
, json
,
json-N
, bunyan
(the native bunyan 0-indent JSON output) or inspect
.
-j
Shortcut for -o json
.
-L
, --time local
Display the time field in local time, rather than the default UTC -time.