Socket
Socket
Sign inDemoInstall

pino-pretty

Package Overview
Dependencies
Maintainers
4
Versions
88
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

pino-pretty - npm Package Compare versions

Comparing version 1.0.0 to 1.0.1

lib/constants.js

5

bin.js

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

const prettyFactory = require('./')
const CONSTANTS = require('./lib/constants')

@@ -14,7 +15,7 @@ args

.option(['f', 'crlf'], 'Append CRLF instead of LF to formatted lines')
.option(['d', 'dateFormat'], 'A format string to govern display of dates', 'yyyy-MM-dd HH:mm:ss.SSS Z')
.option(['d', 'dateFormat'], 'A format string to govern display of dates. When not set to the default value, `--translateTime` is implied', CONSTANTS.DATE_FORMAT)
.option(['e', 'errorProps'], 'Comma separated list of properties on error objects to show (`*` for all properties)', '')
.option(['l', 'levelFirst'], 'Display the log level as the first output field')
.option(['k', 'errorLikeObjectKeys'], 'Define which keys contain error objects (`-k err,error`)', 'err,error')
.option(['m', 'messageKey'], 'Highlight the message under the specified key', 'msg')
.option(['m', 'messageKey'], 'Highlight the message under the specified key', CONSTANTS.MESSAGE_KEY)
.option(['n', 'localTime'], 'Display timestamps according to system timezone')

@@ -21,0 +22,0 @@ .option(['t', 'translateTime'], 'Convert Epoch timestamps to ISO format')

@@ -7,2 +7,4 @@ 'use strict'

const CONSTANTS = require('./lib/constants')
const levels = {

@@ -21,3 +23,3 @@ default: 'USERLVL',

crlf: false,
dateFormat: 'yyyy-mm-dd HH:MM:ss.l o',
dateFormat: CONSTANTS.DATE_FORMAT,
errorLikeObjectKeys: ['err', 'error'],

@@ -27,3 +29,3 @@ errorProps: '',

localTime: false,
messageKey: 'msg',
messageKey: CONSTANTS.MESSAGE_KEY,
translateTime: false,

@@ -60,2 +62,6 @@ useMetadata: false,

if (opts.dateFormat.length > 0 && opts.dateFormat !== CONSTANTS.DATE_FORMAT) {
opts.translateTime = true
}
const color = {

@@ -62,0 +68,0 @@ default: nocolor,

4

package.json
{
"name": "pino-pretty",
"version": "1.0.0",
"version": "1.0.1",
"description": "Prettifier for Pino log lines",

@@ -13,3 +13,3 @@ "main": "index.js",

"test": "tap --no-cov 'test/**/*.test.js'",
"test-ci": "tap --cov --coverage-report=text 'test/**/*.test.js'"
"test-ci": "tap --cov 'test/**/*.test.js'"
},

@@ -16,0 +16,0 @@ "repository": {

<a id="intro"></a>
# pino-pretty
[![Build Status](https://travis-ci.org/pinojs/pino-pretty.svg?branch=master)](https://travis-ci.org/pinojs/pino-pretty)
[![Coverage Status](https://coveralls.io/repos/github/pinojs/pino-pretty/badge.svg?branch=master)](https://coveralls.io/github/pinojs/pino-pretty?branch=master)

@@ -45,2 +47,4 @@ This module provides a basic log prettifier for the [Pino](https://getpino.io/)

see the [`dateformat` documentation](https://www.npmjs.com/package/dateformat).
When the value is anything other than the default value, `--translateTime` is
implied.
+ `--errorProps` (`-e`): When formatting an error object, display this list

@@ -47,0 +51,0 @@ of properties. The list should be a comma separated list of properties Default: `''`.

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

t.plan(1)
const pretty = prettyFactory({
translateTime: true,
dateFormat: 'yyyy-mm-dd HH:MM'
})
const pretty = prettyFactory({dateFormat: 'yyyy-mm-dd HH:MM'})
const log = pino({}, new Writable({

@@ -146,0 +143,0 @@ write (chunk, enc, cb) {

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

t.test('translates time to default format', (t) => {
t.plan(1)
const child = spawn(process.argv0, [bin, '-t'])
child.on('error', t.threw)
child.stdout.on('data', (data) => {
t.is(data.toString(), `[2018-03-30 17:35:28.992 +0000] INFO (42 on foo): hello world\n`)
})
child.stdin.write(logLine)
t.tearDown(() => child.kill())
})
t.end()
})
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