Questions tagged [pinojs]

pino is a very low overhead Node.js logger.

https://www.npmjs.com/package/pino

62 questions
2
votes
1 answer

How to reuse the same crypto.Cipheriv instance in Pino transport transform buffer?

I'm using Pino. I'm trying to encrypt the log stream and write it to a file. One way I can achieve this is creating a pipeline where I can transform the data and encrypt its contents, like so (works fine): import build from…
Rick Stanley
  • 732
  • 2
  • 9
  • 23
2
votes
1 answer

Logs with Pino not showing in Datadog APM trace logs

I'm having trouble getting Pino logs to show up in Datadog APM traces, even though, it would appear that the log injection is working fine. So I have dd-trace all running fine, and traces and spans appearing perfectly in APM. I then hook up Pino, I…
keogh
  • 458
  • 1
  • 3
  • 14
2
votes
0 answers

Node.js Pino logging - multistream vs transport

I'm using Pino for logging in a Node app. I have read the documentation a few times, and it's still not clear. It would seem that Pino's multistream API accomplishes virtually the same thing as their new transport API. I see that the Transport API…
Switch386
  • 454
  • 6
  • 19
2
votes
1 answer

Format pino file stream with pino-pretty

I build my first logger for my discord .js bot. Now I need help with this: How can I format the output fs stream also with pino-pretty? This is my code var fs = require('fs'); var pinoms = require('pino-multi-stream') const date = new Date() const…
Watermelon
  • 21
  • 3
2
votes
1 answer

How to change the log level of AWS Lambdas(NodeJS) at runtime?

we use pino logger and it looks like this: import pino from 'pino-lambda'; const logger = pino({ name: 'ac', level: process.env.STAGE == 'prod' ? 'info' : 'debug', redact: ['password', ] }); export default logger; How to change the…
systemdebt
  • 4,589
  • 10
  • 55
  • 116
2
votes
0 answers

Using pino api to add logs from different modules into file

I am working on nodejs project. How to add Pino logger on different modules and add logs into a a file. I can add logs on console though. Can you please advise on adding all logs in one log file using pino. logger.ts const childProcess =…
Learner
  • 99
  • 3
  • 14
2
votes
0 answers

SIGINT, beforeExit and exit event handlers not called for ctrl-c keypress when application output is piped on

Note: I've already seen SIGINT handler in NodeJS app not called for ctrl-C (Mac) but it seems it's not my case. I have a Node.js application - a Discord bot that uses Pino for logging. Main file, app.js is like this: ... const logger = pino(); const…
Forseti
  • 2,587
  • 6
  • 21
  • 32
2
votes
3 answers

How I can use pino as a logger?

I'm just starting out using pino with pino-pretty. I really looked for documentation to learn how to use it but I found it difficult to understand how to implement it to my application. Could anyone give me some help please?
1
vote
1 answer

How to integrate pino-http with AsyncLocalStorage?

I am using pino-http to log requests with the code below import { pino } from 'pino'; import { pinoHttp } from 'pino-http'; import { v4 } from 'uuid'; export const logger = pino({ enabled: process.env.LOG_ENABLED === 'true', formatters: { …
PirateApp
  • 5,433
  • 4
  • 57
  • 90
1
vote
0 answers

How to integrate adminjs with pino-http?

I would like to log every request made into adminjs along with the account Id or admin user Id of the person who executed the request. How can I hook into adminjs and log HTTP requests made by pino-http This is what my authenticated router looks…
PirateApp
  • 5,433
  • 4
  • 57
  • 90
1
vote
0 answers

Pino write client logging to a file

On my next js app, I'm trying to use pino (v 8.7.0) where I want to log client to a file. I tried following their documentation on transports, but I had no success. I get an eror message saying Error: unable to determine transport target for…
usr4896260
  • 1,427
  • 3
  • 27
  • 50
1
vote
0 answers

pino return label instead of number level

On my next js app, I'm trying to use pino (v 8.7.0) where I want the client logs to return levels with labels instead of numbers. Based on the pino documentation, I've added a formatter. However, I'm still getting numbers after I tried the…
usr4896260
  • 1,427
  • 3
  • 27
  • 50
1
vote
0 answers

Pino conditional transport

Trying to conditionally use a pino transport. In particular pino-slack-transport. The level is set to error, but need to conditionally send logs to the transport based upon another variable (ie environment variable which is production or…
Dave
  • 21
  • 1
1
vote
0 answers

How to setup multiple pipelines in pino logger

I am trying to integrate pino logger with nextjs application. This application requires to write two log files based on level- info and error. It should transform data before writing information in the log file. I tried something below but it didn't…
Himanshu
  • 11
  • 3
1
vote
0 answers

Global variable for 'log' in other files is undefined since it is set after project is started in nodejs

I am using 'pino' package to create log object and using this object to display logs. However, I want to customize my log object by setting the object with a value I pass from outside. I need to use this object in all other files to print logs.…