Socket
Socket
Sign inDemoInstall

pino

Package Overview
Dependencies
Maintainers
2
Versions
310
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 0.1.2 to 0.2.0

bin.js

3

example.js

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

info({ obj: 42 }, 'hello world')
info({ obj: 42, b: 2 }, 'hello world')
info({ obj: { aa: 'bbb' } }, 'another')
setImmediate(info, 'after setImmediate')
error(new Error('an error'))
{
"name": "pino",
"version": "0.1.2",
"version": "0.2.0",
"description": "your logger, inspired by bunyan",
"main": "pino.js",
"bin": {
"pino": "./bin.js"
},
"scripts": {

@@ -36,2 +39,5 @@ "test": "standard && tap test.js"

"dependencies": {
"chalk": "^1.1.1",
"core-util-is": "^1.0.2",
"fast-json-parse": "^1.0.0",
"json-stringify-safe": "^5.0.1",

@@ -38,0 +44,0 @@ "split2": "^2.0.1"

14

pino.js

@@ -87,9 +87,17 @@ 'use strict'

function asJson (obj, msg, num) { // eslint-disable-line no-unused-vars
if (!msg && obj instanceof Error) {
msg = obj.message
}
var data = JSON.stringify(new Message(num, msg))
if (obj) {
data = data.slice(0, data.length - 1)
for (var key in obj) {
data += ',"' + key + '":' + stringify(obj[key])
if (obj instanceof Error) {
data += ',"type":"Error","stack":' + stringify(obj.stack) + '}'
} else {
for (var key in obj) {
data += ',"' + key + '":' + stringify(obj[key])
}
data += '}'
}
data += '}'
}

@@ -96,0 +104,0 @@ return data + '\n'

# pino
[Extremely fast](#benchmarks) node.js logger, inspired by Bunyan.
It also includes a shell utility to pretty-print its log files.
![cli](https://raw.githubusercontent.com/mcollina/pino/master/demo.png)
Still _alpha code_, and in active development.

@@ -24,2 +27,3 @@

var info = pino.info
var error = pino.error

@@ -30,2 +34,3 @@ info('hello world')

setImmediate(info, 'wrapped')
error(new Error('something bad happened'))
```

@@ -32,0 +37,0 @@

@@ -86,2 +86,24 @@ 'use strict'

})
test('passing error at level ' + name, function (t) {
t.plan(2)
var err = new Error('myerror')
var instance = pino(sink(function (chunk, enc, cb) {
t.ok(Date.parse(chunk.time) <= new Date(), 'time is greater than Date.now()')
delete chunk.time
t.deepEqual(chunk, {
pid: pid,
hostname: hostname,
level: level,
type: 'Error',
msg: err.message,
stack: err.stack,
v: 0
})
cb()
}))
instance.level = name
instance[name](err)
})
}

@@ -88,0 +110,0 @@

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