pino-pretty
Advanced tools
Comparing version 9.3.0 to 9.4.0
@@ -43,2 +43,3 @@ #!/usr/bin/env node | ||
colorize: 'c', | ||
colorizeObjects: 'C', | ||
crlf: 'f', | ||
@@ -45,0 +46,0 @@ errorProps: 'e', |
@@ -111,2 +111,7 @@ // Type definitions for pino-pretty 7.0 | ||
/** | ||
* If set to false while `colorize` is `true`, will output JSON objects without color. | ||
* @default true | ||
*/ | ||
colorizeObjects?: boolean; | ||
/** | ||
* Appends carriage return and line feed, instead of just a line feed, to the formatted log line. | ||
@@ -113,0 +118,0 @@ * @default false |
@@ -34,2 +34,3 @@ 'use strict' | ||
colorize: isColorSupported, | ||
colorizeObjects: true, | ||
crlf: false, | ||
@@ -100,2 +101,3 @@ errorLikeObjectKeys: ERROR_LIKE_KEYS, | ||
const colorizer = colors(opts.colorize, customColors, useOnlyCustomProps) | ||
const objectColorizer = opts.colorizeObjects ? colorizer : colors(false, [], false) | ||
@@ -198,3 +200,3 @@ return pretty | ||
singleLine, | ||
colorizer | ||
colorizer: objectColorizer | ||
}) | ||
@@ -201,0 +203,0 @@ |
{ | ||
"name": "pino-pretty", | ||
"version": "9.3.0", | ||
"version": "9.4.0", | ||
"description": "Prettifier for Pino log lines", | ||
@@ -5,0 +5,0 @@ "type": "commonjs", |
@@ -60,2 +60,3 @@ <a id="intro"></a> | ||
- `--colorize` (`-c`): Adds terminal color escape sequences to the output. | ||
- `--colorizeObjects` (`-C`): Allows suppressing colorization of objects when set to `false`. In combination with `--singleLine`, this ensures that the end of each line is parsable JSON. | ||
- `--crlf` (`-f`): Appends carriage return and line feed, instead of just a line | ||
@@ -239,2 +240,3 @@ feed, to the formatted log line. | ||
colorize: colorette.isColorSupported, // --colorize | ||
colorizeObjects: true, //--colorizeObjects | ||
crlf: false, // --crlf | ||
@@ -241,0 +243,0 @@ errorLikeObjectKeys: ['err', 'error'], // --errorLikeObjectKeys |
@@ -85,2 +85,18 @@ 'use strict' | ||
t.test('will omit color codes from objects when colorizeObjects = false', (t) => { | ||
t.plan(1) | ||
const pretty = prettyFactory({ colorize: true, singleLine: true, colorizeObjects: false }) | ||
const log = pino({}, new Writable({ | ||
write (chunk, enc, cb) { | ||
const formatted = pretty(chunk.toString()) | ||
t.equal( | ||
formatted, | ||
`[${formattedEpoch}] \u001B[32mINFO\u001B[39m (${pid}): \u001B[36mfoo\u001B[39m {"foo":"bar"}\n` | ||
) | ||
cb() | ||
} | ||
})) | ||
log.info({ foo: 'bar' }, 'foo') | ||
}) | ||
t.test('can swap date and level position', (t) => { | ||
@@ -87,0 +103,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
184883
4089
370