Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

pino

Package Overview
Dependencies
Maintainers
4
Versions
311
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

pino - npm Package Compare versions

Comparing version 3.3.2 to 3.4.0

test/fixtures/pretty/basic.js

14

docs/API.md
# Table of Contents
+ [Constructor](#constructor)
* [.pretty](#pretty)
+ [Logger](#logger)
+ [pino](#constructor)
+ [pino.pretty](#pretty)
+ [Logger Instance](#logger)
* [.child](#child)

@@ -56,2 +56,4 @@ * [.level](#level)

integer value to define the new level. Default: `undefined`.
* `prettyPrint` (boolean|object): enables [pino.pretty](#pretty). This is intended for non-production
configurations. This may be set to a configuration object as outlined in [pino.pretty](#pretty). Default: `false`.
* `enabled` (boolean): enables logging. Default: `true`

@@ -87,2 +89,4 @@ + `stream` (Writable): a writable stream where the logs will be written.

JSON object as an argument and should return a string value.
* `levelFirst` (boolean): if set to `true`, it will print the name of the log
level as the first field in the log line. Default: `false`.

@@ -108,2 +112,6 @@ ### Example:

This can also be enabled via the [constructor](#constructor) by setting the
`prettyPrint` option to either `true` or a configuration object described
in this section.
<a id="logger"></a>

@@ -110,0 +118,0 @@ # Logger

{
"name": "pino",
"version": "3.3.2",
"version": "3.4.0",
"description": "super fast, all natural json logger",

@@ -82,2 +82,3 @@ "main": "pino.js",

"once": "^1.3.3",
"pump": "^1.0.2",
"quick-format-unescaped": "^1.0.0",

@@ -84,0 +85,0 @@ "split2": "^2.0.1"

@@ -6,3 +6,5 @@ 'use strict'

var fs = require('fs')
var pump = require('pump')
var flatstr = require('flatstr')
var pretty = require('./pretty')
var events = require('./lib/events')

@@ -24,2 +26,3 @@ var levels = require('./lib/levels')

levelVal: undefined,
prettyPrint: false,
enabled: true

@@ -35,4 +38,13 @@ }

}
iopts = Object.assign({}, defaultOptions, iopts)
if (iopts.extreme && iopts.prettyPrint) throw Error('cannot enable pretty print in extreme mode')
istream = istream || process.stdout
iopts = Object.assign({}, defaultOptions, iopts)
if (iopts.prettyPrint) {
var pstream = pretty(iopts.prettyPrint)
var origStream = istream
pump(pstream, origStream, function (err) {
if (err) logger.emit('error', err)
})
istream = pstream
}

@@ -265,3 +277,3 @@ // internal options

}
module.exports.pretty = require('./pretty')
module.exports.pretty = pretty
Object.defineProperty(

@@ -268,0 +280,0 @@ module.exports,

@@ -6,2 +6,5 @@ 'use strict'

var os = require('os')
var path = require('path')
var writeStream = require('flush-write-stream')
var fork = require('child_process').fork
var split = require('split2')

@@ -190,1 +193,31 @@ var hostname = os.hostname()

})
test('can be enabled via constructor', function (t) {
t.plan(1)
var actual = ''
var child = fork(path.join(__dirname, 'fixtures', 'pretty', 'basic.js'), {silent: true})
child.stdout.pipe(writeStream(function (s, enc, cb) {
actual += s
cb()
}))
child.on('close', function () {
t.notEqual(actual.match(/\(123456 on abcdefghijklmnopqr\): h/), null)
})
})
test('can be enabled via constructor with pretty configuration', function (t) {
t.plan(1)
var actual = ''
var child = fork(path.join(__dirname, 'fixtures', 'pretty', 'levelFirst.js'), {silent: true})
child.stdout.pipe(writeStream(function (s, enc, cb) {
actual += s
cb()
}))
child.on('close', function () {
t.notEqual(actual.match(/^INFO.*h/), null)
})
})
SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc