Comparing version 2.10.1 to 2.11.0
{ | ||
"name": "pino", | ||
"version": "2.10.1", | ||
"version": "2.11.0", | ||
"description": "fast and simple logger", | ||
@@ -5,0 +5,0 @@ "main": "pino.js", |
21
pino.js
@@ -38,3 +38,3 @@ 'use strict' | ||
var lscache = Object.keys(nums).reduce(function (o, k) { | ||
o[k] = flatstr('"level":' + Number(k) + ',"time":') | ||
o[k] = flatstr('"level":' + Number(k)) | ||
return o | ||
@@ -62,2 +62,3 @@ }, {}) | ||
opts = opts || {} | ||
var timestamp = (opts.hasOwnProperty('timestamp')) ? opts.timestamp : true | ||
var slowtime = opts.slowtime | ||
@@ -80,3 +81,3 @@ var safe = opts.safe !== false | ||
var logger = new Pino(level, stream, serializers, stringify, end, name, slowtime, '', cache, formatOpts) | ||
var logger = new Pino(level, stream, serializers, stringify, end, name, timestamp, slowtime, '', cache, formatOpts) | ||
if (cache) { | ||
@@ -121,3 +122,3 @@ // setImmediate is causing a very weird crash: | ||
function Pino (level, stream, serializers, stringify, end, name, slowtime, chindings, cache, formatOpts) { | ||
function Pino (level, stream, serializers, stringify, end, name, timestamp, slowtime, chindings, cache, formatOpts) { | ||
this.stream = stream | ||
@@ -128,2 +129,3 @@ this.serializers = serializers | ||
this.name = name | ||
this.timestamp = timestamp | ||
this.slowtime = slowtime | ||
@@ -138,3 +140,5 @@ this.chindings = chindings | ||
if (slowtime) { | ||
if (timestamp === false) { | ||
this.time = getNoTime | ||
} else if (slowtime) { | ||
this.time = getSlowTime | ||
@@ -254,8 +258,12 @@ } else { | ||
function getNoTime () { | ||
return '' | ||
} | ||
function getTime () { | ||
return Date.now() | ||
return ',"time":' + Date.now() | ||
} | ||
function getSlowTime () { | ||
return '"' + (new Date()).toISOString() + '"' | ||
return ',"time":"' + (new Date()).toISOString() + '"' | ||
} | ||
@@ -287,2 +295,3 @@ | ||
this.name, | ||
this.timestamp, | ||
this.slowtime, | ||
@@ -289,0 +298,0 @@ data, |
@@ -223,2 +223,3 @@ ![banner](pino-banner.png) | ||
* `serializers`: an object containing functions for custom serialization of objects. These functions should return an JSONifiable object and they should never throw | ||
* `timestamp`: Enables or disables the inclusion of a timestamp in the log message. `slowtime` has no effect if this option is set to `false`. Defaults to `true`. | ||
* `slowtime`: Outputs ISO time stamps (`'2016-03-09T15:18:53.889Z'`) instead of Epoch time stamps (`1457536759176`). **WARNING**: This option carries a 25% performance drop, we recommend using default Epoch timestamps and transforming logs after if required. The `pino -t` command will do this for you (see [CLI](#cli)). default `false`. | ||
@@ -225,0 +226,0 @@ * `extreme`: Enables extreme mode, yields an additional 60% performance (from 250ms down to 100ms per 10000 ops). There are trade-off's should be understood before usage. See [Extreme mode explained](#extreme). default `false` |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
587822
31
2226
1003