Comparing version 0.1.1 to 1.0.0
@@ -5,20 +5,21 @@ const debug = require('debug')('pino-tiny:logger') | ||
const Pump = require('pump') | ||
const Fs = require('fs') | ||
const { getTransform } = require('./transformer') | ||
const { parse, noop, shutdown } = require('./utils') | ||
const { parse, noop } = require('./utils') | ||
function start (options) { | ||
debug('logging started') | ||
const { exit, filter } = options | ||
const { filter } = options | ||
const transformer = Through.obj(getTransform(filter || noop)) | ||
const parser = Split(parse) | ||
Pump(process.stdin, parser, transformer, process.stdout).on('error', console.error) | ||
// https://github.com/pinojs/pino/pull/358 | ||
/* istanbul ignore next */ | ||
process.stdin.on('end', () => shutdown('input ended', exit)) | ||
/* istanbul ignore next */ | ||
process.on('SIGINT', () => shutdown('SIGINT', exit)) | ||
/* istanbul ignore next */ | ||
process.on('SIGTERM', () => shutdown('SIGTERM', exit)) | ||
if (!process.stdin.isTTY && !Fs.fstatSync(process.stdin.fd).isFile()) { | ||
process.once('SIGINT', function noOp () { console.log() /* print a line after ^C */ }) | ||
} | ||
} | ||
module.exports = { start } |
@@ -1,3 +0,1 @@ | ||
const debug = require('debug')('pino-tiny:utils') | ||
function parse (line) { | ||
@@ -18,11 +16,5 @@ try { | ||
} | ||
function shutdown (reason, exit) { | ||
debug('logging stopped: %s', reason) | ||
/* istanbul ignore if */ | ||
if (typeof exit === 'undefined' || exit) { // this is so it does not kill unit test | ||
process.exit(0) | ||
} | ||
} | ||
function noop (x) { return x } | ||
module.exports = { noop, shutdown, parse } | ||
module.exports = { noop, parse } |
{ | ||
"name": "pino-tiny", | ||
"version": "0.1.1", | ||
"version": "1.0.0", | ||
"description": "a very minimalistic output for pino logger", | ||
@@ -5,0 +5,0 @@ "main": "lib/index.js", |
# pino-tiny | ||
[![Build Status](https://travis-ci.com/holmok/pino-tiny.svg?branch=master)](https://travis-ci.com/github/holmok/pino-tiny/builds/) | ||
a tiny little log formatter for [pino](https://github.com/pinojs/pino). | ||
@@ -4,0 +7,0 @@ |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Filesystem access
Supply chain riskAccesses the file system, and could potentially read sensitive data.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
No v1
QualityPackage is not semver >=1. This means it is not stable and does not support ^ ranges.
Found 1 instance in 1 package
0
81
6284
78
1