Closed sviridoff closed 2 years ago
I have some question, if there are a way to colorize part of output log, I tried to do the following but didnt succeed:
// logger_transport.js
import jsonColorizer from '@pinojs/json-colorizer'; import pinoPretty from 'pino-pretty'; function colorizeJSON(value) { return jsonColorizer(value, { pretty: true }); } export default function (options) { return pinoPretty({ ...options, customPrettifiers: { request: colorizeJSON, // trying to colorize the values of request key. }, }); }
// logger.js
import pino from 'pino'; const logger = pino({ transport: { target: './logger_transport', options: { colorize: true, translateTime: true, levelFirst: true, }, }, }); logger.info({ request: { key: 'value' } });
Im using docker, maybe is a part of the problem, pino pretty is able to colorize the level part of the message, json colorizer not.
Im using @pinojs/json-colorizer 3.0.0, pino 7.9.0 and pino-pretty 7.5.4
@pinojs/json-colorizer 3.0.0
pino 7.9.0
pino-pretty 7.5.4
solved following this comment https://github.com/pinojs/pino-pretty/issues/220#issuecomment-921093676 adding FORCE_COLOR to the envs
I have some question, if there are a way to colorize part of output log, I tried to do the following but didnt succeed:
// logger_transport.js
// logger.js
Im using docker, maybe is a part of the problem, pino pretty is able to colorize the level part of the message, json colorizer not.
Im using
@pinojs/json-colorizer 3.0.0
,pino 7.9.0
andpino-pretty 7.5.4