Comparing version 4.3.0 to 4.4.0
@@ -17,2 +17,3 @@ #! /usr/bin/env node | ||
levelFirst: arg('-l'), | ||
forceColor: arg('-c'), | ||
messageKey: messageKeyArg() | ||
@@ -19,0 +20,0 @@ })).pipe(process.stdout) |
@@ -100,2 +100,4 @@ # Table of Contents | ||
message. Default: `msg`. | ||
* `forceColor` (boolean): if set to `true`, will add color information to the formatted output | ||
message. Default: `false`. | ||
@@ -102,0 +104,0 @@ ### Example: |
@@ -65,1 +65,13 @@ # CLI | ||
``` | ||
If you would like to enforce the output to be color encoded you can specify the `-c` flag | ||
`cat log | pino -c` will transform this: | ||
```js | ||
{"pid":14139,"hostname":"MacBook-Pro-3.home","level":30,"fooMessage":"hello world","time":1457537229339,"v":1} | ||
``` | ||
Into this: | ||
```sh | ||
[2017-04-25T17:32:09.662Z] [32mINFO[39m (24280 on SP2): [36mhello world[39m | ||
``` |
{ | ||
"name": "pino", | ||
"version": "4.3.0", | ||
"version": "4.4.0", | ||
"description": "super fast, all natural json logger", | ||
@@ -5,0 +5,0 @@ "main": "pino.js", |
@@ -60,2 +60,3 @@ 'use strict' | ||
var messageKey = opts && opts.messageKey | ||
var forceColor = opts && opts.forceColor | ||
messageKey = messageKey || 'msg' | ||
@@ -71,3 +72,3 @@ | ||
ctx = new chalk.constructor({ | ||
enabled: !!(chalk.supportsColor && dest.isTTY) | ||
enabled: !!((chalk.supportsColor && dest.isTTY) || forceColor) | ||
}) | ||
@@ -74,0 +75,0 @@ |
@@ -43,2 +43,13 @@ 'use strict' | ||
test('pino pretty force color on flag', function (t) { | ||
t.plan(1) | ||
var prettier = pretty({ forceColor: true }) | ||
prettier.pipe(split(function (line) { | ||
t.ok(line.match(/.*\u001b\[32mINFO\u001b\[39m.*\u001b\[36mhello world\u001b\[39m$/), 'color coding information is encoded in the line') | ||
return line | ||
})) | ||
var instance = pino(prettier) | ||
instance.info('hello world') | ||
}) | ||
test('pino transform can just parse the dates', function (t) { | ||
@@ -45,0 +56,0 @@ t.plan(1) |
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
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
128412
3018