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.0 to 0.1.1

.travis.yml

2

example.js

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

var info = pino.info
var error = pino.error
info('hello world')
error('this is at error level')
info('the answer is %d', 42)
info({ obj: 42 }, 'hello world')
setImmediate(info, 'after setImmediate')

2

package.json
{
"name": "pino",
"version": "0.1.0",
"version": "0.1.1",
"description": "your logger, inspired by bunyan",

@@ -5,0 +5,0 @@ "main": "pino.js",

@@ -19,3 +19,3 @@ 'use strict'

function sermon (stream, opts) {
function pino (stream, opts) {
stream = stream || process.stdout

@@ -38,24 +38,3 @@ opts = opts || {}

for (var key in levels) {
// needed because we cannot put arguments manipulation
// in another function without paying a perf drop
eval('' + // eslint-disable-line no-eval
'funcs.' + key + ' = function ' + key + ' () {\n' +
' var base = 0\n' +
' var obj = null\n' +
' var msg // so it does not happear in the json\n' +
' if (is.isObject(arguments[0])) {\n' +
' obj = arguments[0]\n' +
' base += 1\n' +
' }\n' +
' var toFormat = new Array(arguments.length - base)\n' +
' for (var i = base; i < arguments.length; i++) {\n' +
' toFormat[i - base] = arguments[i]\n' +
' }\n' +
' if (toFormat.length > 0) {\n' +
' msg = format.apply(null, toFormat)\n' +
' }\n' +
' stream.write(asJson(obj, msg, ' + levels[key] + ' ))\n' +
'}'
)
funcs[key] = genLogFunction(key)
}

@@ -88,2 +67,24 @@

function genLogFunction (key) {
var level = levels[key]
return function (a, b, c, d, e, f, g, h, i, j, k) {
var base = 0
var obj = null
var params = null
var msg
if (Object(a) === a) {
obj = a
params = [b, c, d, e, f, g, h, i, j, k]
base = 1
} else {
params = [a, b, c, d, e, f, g, h, i, j, k]
}
if ((params.length = arguments.length - base) > 0) {
msg = format.apply(null, params)
}
stream.write(asJson(obj, msg, level))
}
}
function asJson (obj, msg, num) { // eslint-disable-line no-unused-vars

@@ -114,2 +115,2 @@ var data = JSON.stringify(new Message(num, msg))

module.exports = sermon
module.exports = pino
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