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

pino

Package Overview
Dependencies
Maintainers
2
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 2.8.3 to 2.9.0

6

package.json
{
"name": "pino",
"version": "2.8.3",
"version": "2.9.0",
"description": "fast and simple logger",

@@ -43,4 +43,4 @@ "main": "pino.js",

"pre-commit": "^1.1.2",
"standard": "^7.0.0",
"tap": "^5.5.0",
"standard": "^8.0.0",
"tap": "^7.0.0",
"winston": "^2.1.1"

@@ -47,0 +47,0 @@ },

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

// to catch both null and undefined
/*eslint-disable eqeqeq*/
/* eslint-disable eqeqeq */
if (msg != undefined) {

@@ -216,0 +216,0 @@ data += ',"msg":"' + fastRep(msg) + '"'

@@ -51,2 +51,3 @@ #! /usr/bin/env node

var timeTransOnly = opts && opts.timeTransOnly
var levelFirst = opts && opts.levelFirst

@@ -88,7 +89,10 @@ var stream = split(mapLine)

if (timeTransOnly) {
value.time = new Date(value.time).toISOString()
value.time = asISODate(value.time)
return JSON.stringify(value) + '\n'
}
line = '[' + new Date(value.time).toISOString() + '] ' + asColoredLevel(value)
line = (levelFirst)
? asColoredLevel(value) + ' [' + asISODate(value.time) + ']'
: '[' + asISODate(value.time) + '] ' + asColoredLevel(value)
line += ' ('

@@ -112,2 +116,6 @@ if (value.name) {

function asISODate (time) {
return new Date(time).toISOString()
}
function asColoredLevel (value) {

@@ -127,3 +135,4 @@ return levelColors[value.level](levels[value.level])

process.stdin.pipe(pretty({
timeTransOnly: arg('-t')
timeTransOnly: arg('-t'),
levelFirst: arg('-l')
})).pipe(process.stdout)

@@ -130,0 +139,0 @@ }

@@ -152,10 +152,17 @@ ![banner](pino-banner.png)

There's also a transformer flag that converts Epoch timestamps to ISO timestamps.
There are also two transformer flags..
`-t` that converts Epoch timestamps to ISO timestamps.
```sh
cat log | pino -t
```
and `-l` that flips the time and level on the standard output.
For instance, `pino -t` will transform this:
```sh
cat log | pino -l
```
`pino -t` will transform this:
```js

@@ -171,2 +178,15 @@ {"pid":14139,"hostname":"MacBook-Pro-3.home","level":30,"msg":"hello world","time":1457537229339,"v":0}

`pino -l` will transform this:
```sh
[2016-03-09T15:27:09.339Z] INFO (14139 on MacBook-Pro-3.home): hello world
```
Into this:
```sh
INFO [2016-03-09T15:27:09.339Z] (14139 on MacBook-Pro-3.home): hello world
```
<a name="api"></a>

@@ -173,0 +193,0 @@ ## API

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

t.ok(line.match(/.*hello world$/), 'end of line matches')
t.ok(line.match(/.*INFO.*/), 'includes level')
t.ok(line.match(/(?!^)INFO.*/), 'includes level')
t.ok(line.indexOf('' + process.pid) > 0, 'includes pid')

@@ -25,2 +25,17 @@ t.ok(line.indexOf('' + hostname) > 0, 'includes hostname')

test('pino pretty moves level to start on flag', function (t) {
t.plan(4)
var pretty = pino.pretty({ levelFirst: true })
pretty.pipe(split(function (line) {
t.ok(line.match(/.*hello world$/), 'end of line matches')
t.ok(line.match(/^INFO.*/), 'level is at start of line')
t.ok(line.indexOf('' + process.pid) > 0, 'includes pid')
t.ok(line.indexOf('' + hostname) > 0, 'includes hostname')
return line
}))
var instance = pino(pretty)
instance.info('hello world')
})
test('pino transform can just parse the dates', function (t) {

@@ -27,0 +42,0 @@ t.plan(1)

@@ -12,2 +12,6 @@

To flip level and time/date in standard output use the -l flag
cat log | pino -l
Flags

@@ -17,2 +21,3 @@ -h | --help Display Help

-t Convert Epoch timestamps to ISO
-l Flip level and date
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