winston Questions

3

I am getting an error with winston logging if I am using winston-daily-rotate-file. When I am building my application with webpack there are no errors but when I execute my build below error is com...
Insolvent asked 22/8, 2020 at 14:55

5

Solved

Got below error in winston when using file logging with winston-daily-rotate-file package, code works well with winston console logging, MaxListenersExceededWarning: Possible EventEmitter memory...
Fike asked 1/11, 2019 at 3:14

1

I started using winston, express-winston and winston-mongodb to log both request and responses and add them to the mongodb. After a while I was able to generate the logs while also hiding informati...
Pyro asked 11/10, 2018 at 14:26

8

Solved

I use Winston for my backend logging I cannot log the object without using JSON.stringify which is annoying logger.debug(`Register ${JSON.stringify(req.body)}`) const logger: Logger = createLogg...
Yehudit asked 11/5, 2019 at 13:36

4

Solved

I'm writing a rest api with NodeJS and express and I'm using express-winston to log accesses and erros. But I want to separate de log daily. Like in this post I'm trying to do so with winston.tran...
Suppurate asked 2/2, 2016 at 16:30

4

Solved

I need to rotate the logs daily except the file for current day. I'm using winston and winston-daily-rotate-file libraries. In the following example, a file "info.log.2016-08-09" is generated jus...
Disenthral asked 9/8, 2016 at 14:10

3

Solved

The winston library is great for transports and flexibility. I'd like to use it to allow configuring levels and redirecting to files, but would like to reproduce console.log behavior for formatting...
Supernova asked 27/3, 2019 at 22:58

11

Solved

I want to add timestamp to logs. What is the best way to achieve this? Thanks.
Expediency asked 22/4, 2012 at 19:33

13

It seems nice for API's, scripts and what not. But reading a winston json stack trace is very hard with a text editor. E.g. {"level":"info","message":"starting","timestamp":"2014-05-14T15:45:44.33...
Drucill asked 14/5, 2014 at 16:5

5

I am using Winston for logging with 2 different transports - File and MongoDB. I have set the level for File as "INFO" and for MongoDB as "ERROR". If I now log, log.info('some info...'); log.warn(...
Posen asked 30/5, 2014 at 11:13

1

I'm using winston for structured logging and I'd like to change the "message" key name in winston to something else like "payload". Is this possible? e.g. {"message":{"x": 9},"level":"error"} t...
Sheri asked 9/6, 2020 at 20:32

2

Solved

First of all, I'm new to es6 and jest. I have a Logger class for instantiate winston and I would like to test it. Here my code : const winston = require('winston'); const fs = require('fs'); con...
Secessionist asked 27/4, 2018 at 15:54

7

Solved

I am developing a Node.js application, using babel-cli as an ES6 transpiler and I am using Winston 3.0 as my logging service. Question: I want the whole output of the messages from the winston logg...
Detradetract asked 24/6, 2018 at 17:7

8

I want to store my error logs in mongoDB collection. I am using winston & winston -mongoDB. Getting the error: throw new Error('Invalid transport, must be an object with a log method.'); E...
Bifrost asked 6/8, 2018 at 7:0

2

Solved

I would like to use winston in my express app. I have configured winston like the following: const path = require('path') const winston = require('winston') module.exports = () => { process....
Intercellular asked 6/10, 2017 at 18:6

0

I am using winston with my express application with events. Logger has two transporters for writing to file and console.  Logger is working fine except when there is some error occurrence.  On erro...
Raze asked 8/5, 2023 at 7:0

7

Solved

I'm trying to get Winston to pretty print to the console, so I stuck this in a file and ran it with node: var winston = require('winston'); winston.cli(); winston.data({ a: "test", of: "many", ...
Saki asked 31/7, 2013 at 6:44

4

Solved

My project is right now making use of winston logger to log to console. The problem is, comma is used as concatenation operator in most areas, Like logger.info("here is data", data ) data is a st...
Mouthy asked 17/8, 2018 at 8:13

7

Is it possible to get the line number and file for each log output ? For example: var winston = require('winston'); winston.log('info', 'some message!'); // this is at line 4 of myfile.js sh...
Dungeon asked 6/7, 2017 at 15:17

3

Solved

Initialization: var winston = require('winston'); var logger = new (winston.Logger)({ levels: { trace: 0, input: 1, verbose: 2, prompt: 3, debug: 4, info: 5, data: 6, help: 7, warn: 8, ...
Bowshot asked 16/1, 2016 at 3:50

3

I'm using Winston in my nodejs application. const winston = require('winston'); const logger = winston.createLogger({ transports: [ new winston.transports.Console() ] }); logger.info('What rol...
Prostitution asked 12/3, 2020 at 8:0

3

Solved

I am trying to mock a winston.Logger instance that is encapsulated within a service class created with NestJS. I have included my code below. I cannot get the mocked logger instance to be trigger...
Louettalough asked 3/9, 2019 at 12:18

5

Solved

I am using winston logger. I want to add uuid in every logs having same uuid per request. In app.js var distributorapp = require('./routes/distributorapp'); app.use('/dstapp',distributorapp); ...
Stryker asked 24/2, 2017 at 7:23

3

Solved

I am new to NestJS and would like to customise the log messages to include the x-request-id/x-correlation-id and the name of the file the log message originated but am not sure if there is anything...
Brazilin asked 9/3, 2022 at 11:37

3

Solved

I want to setup logs for my nodejs project inside a directory named logs as per documentation here i am doing : winston.add(winston.transports.File, { filename: 'logs/mylogs.log' }); But it is...
Fistic asked 14/6, 2014 at 12:48

© 2022 - 2025 — McMap. All rights reserved.