Questions tagged [pinojs]

pino is a very low overhead Node.js logger.

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

62 questions
1
vote
1 answer

Writing every log.info content to a text file

I am using Pino and Pino pretty packages for displaying loggers. I would like to write all log.info contents (called from multiple js files in the same project) into a common text file logger.ts import pinoCaller from 'pino-caller' import pino from…
Pavan Kumar
  • 129
  • 7
1
vote
0 answers

Pino logger: how to keep log in dynamically created folders

In my project, there is an option for creating apps. Based on app Id, I need to create folder named app Id and keep trace.log, out.log etc files separately. For logging, pino is used for that. let dir =…
nimsha v.b
  • 43
  • 1
  • 1
  • 7
1
vote
1 answer

How to use pino-transport in nodejs for logs.?

const pino = require('pino') const transport = pino.transport({ targets: [{ level: 'info', target: 'pino-pretty' // must be installed separately }, { level: 'trace', target: 'pino/file', options: { destination:…
Manoj Kumar
  • 169
  • 1
  • 7
1
vote
1 answer

AWS Cloudwatch Node.js stack trace printed in separate log entries

Currently, when an error happens in my Node.js application, each line in the stack trace is printed in a separate log entry, as shown below: What can I do so that, for a single error, its stack trace prints in a single log entry?
1
vote
1 answer

Stubbing pino logger as class instance

I have a custom log service, using a child instance of pinoLogger to log some things. Here is the code : class LogService { ihmLogger = loggerPino.child({}); async log( req: Request, level: number, message: string, …
Michael Maurel
  • 87
  • 2
  • 15
1
vote
1 answer

HTTP Pino logger and Elastic Common Schema (ecs) format in NestJS

I am trying to apply @elastic/ecs-pino-format to nestjs-pino. Under the good nestjs-pino is using http-pino. I have noticed that http-pino adds the request object inside [Symbol(pino.chindings)] and I am assuming it's using a child logger.So I tried…
1
vote
1 answer

How to mock Pino with destination

History. I am using Pino for logging my nodejs Express application. My logger setup was as follows 'use strict'; const pino = require('pino'); const logger = pino({ level: process.env.NODE_ENV === 'production' ? 'info' : 'debug', prettyPrint:…
Ian MacRae
  • 41
  • 2
  • 7
1
vote
1 answer

Using pino api to add logs from different modules into 1 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 pino =…
Learner
  • 99
  • 3
  • 14
1
vote
1 answer

How to rotate log files that generate with pino-multi-stream?

I am using pino-multi-stream npm package in my node.js project as below: const fs = require('fs'); const pino = require('pino'); const multistream = require('pino-multi-stream').multistream; const path = require('path'); const logDirectory =…
Masoud Sadeghi
  • 357
  • 3
  • 15
1
vote
0 answers

Can't send log from Hapi-Pino to Elasticsearch

I'm building server for a website use hapi and hapi-pino for logging. I want to analyze log (about status code, route, timestamp) for some business purpose. I use elasticsearch and kibana to do it Between hapi-pino and Elasticsearch, I try to use…
Leo Aslan
  • 451
  • 1
  • 8
  • 20
1
vote
5 answers

How to make the pino library as generic and call everywhere in the project

I'm very new to node.js and JS world. I'm doing logger into the existing node.js based testing application. I just picked 'pino' and using it as like below: const pino = require('pino'); const logger = pino({ prettyPrint: true …
ArrchanaMohan
  • 2,314
  • 4
  • 36
  • 84
0
votes
1 answer

How to create a noop logger instance of Pino logger?

I want to test a function (using jest) which takes a pino.Logger type object as an argument. I have failed at trying to mock it, so all I need is a noop Logger instance that does nothing. I'm mainly a Go dev and I don't have any problem defining the…
Benjamin R
  • 555
  • 6
  • 25
0
votes
0 answers

How to enable pino-http logs with NestJS-Pino in a Nest.js middleware?

I'm currently using NestJS-Pino as a logging library in my Nest.js application. I have configured a middleware that is supposed to log requests, and I'd like it to show logs that are of the pino-http type. Here is an example of the log format that I…
IdanB
  • 167
  • 1
  • 3
  • 13
0
votes
0 answers

Creating a custom pino logger per request in koa middleware is resulting in open files accumulating

I'm attempting to set up a custom logger per request on my Koa HTTP server using Koa middleware. The custom pino logger should send logs to both the console and a file. However, I'm encountering an issue with my current implementation regarding…
BML91
  • 2,952
  • 3
  • 32
  • 54
0
votes
1 answer

Pino logger not logging anything when setup with multiple transports

When I setup a simple pino logger with custom log levels like so: import pino from "pino"; const simpleLogger = pino({ mixin() { return { appName: "TEST SIMPLE LOGGER" }; }, level: "silly", useOnlyCustomLevels: true, customLevels: { …
BML91
  • 2,952
  • 3
  • 32
  • 54