Questions tagged [winston]

A multi-transport async logging library for node.js.

Winston is designed to be a simple and universal logging library with support for multiple transports. A transport is essentially a storage device for your logs. Each instance of a winston logger can have multiple transports configured at different levels. For example, one may want error logs to be stored in a persistent remote location (like a database), but all logs output to the console or a local file.

There also seemed to be a lot of logging libraries out there that coupled their implementation of logging (i.e. how the logs are stored / indexed) to the API that they exposed to the programmer. This library aims to decouple those parts of the process to make it more flexible and extensible.

935 questions
0
votes
1 answer

winston file transport issue

I'm trying to use winston logger, but it seems to have a strange behavior when used with the file transport. Perhaps it's something I'm missing and I couldn't figure it out. I created a simple example to illustrate the issue. It uses the mocha for…
amccampos
  • 171
  • 6
0
votes
1 answer

How can I pass a filename to wiston logger constructor?

log.js: var winston = require('winston'); var logger = new (winston.Logger)({ transports: [ new (winston.transports.Console)({ json: false, timestamp: true }), new winston.transports.File({ filename: **Get from outside**, json: false }) …
nfpyfzyf
  • 2,891
  • 6
  • 26
  • 30
0
votes
1 answer

Nodejs console overload scope issue

I am trying to override the console in Nodejs with Winston. for (var z in loggerSettings) { console[z] = (function () { var i = z + '' , _backup = console[z]; return function () { var utfs = arguments.length…
Mathew Kurian
  • 5,949
  • 5
  • 46
  • 73
0
votes
1 answer

Why do I get 'Maximum call stack size exceeded' error when trying to create a custom logger (Winston/NodeJS)

I'm trying to understand how to use Winston (NodeJS) by creating a logger with custom levels. logger.js var winston = require('winston'); var custom = { levels: { debug: 0, log : 1, info : 2, ok : 3, warn :…
qodeninja
  • 10,946
  • 30
  • 98
  • 152
0
votes
2 answers

File rotation using winston works unexpected

I have created a Winston logger: _logger.add(logger.transports.File, { filename: conf_fileName, timestamp:'true', maxsize: 1024, maxFiles: 2 }); But after couple of hours I have lot of files in size of ~2kb. Is there something wrong…
Nava Polak Onik
  • 1,509
  • 2
  • 13
  • 17
-1
votes
1 answer

Permission denied when use Winston

In my nodeJS application I used "Winston" module for manage loggers. But when api run give me error given below. node:internal/fs/utils:344 throw err; ^ Error: EACCES: permission denied, mkdir '/var/log/api/general' at Object.mkdirSync…
-1
votes
1 answer

Winston logs does not work in the Docker Container

I am creating a nodejs/express app with typescript. I have installed the winston package. using npm install winston. I am following this article. i want to dockerize this. What i have done so far: I have imported the winston package in the…
JustAG33K
  • 1,403
  • 3
  • 13
  • 28
-1
votes
1 answer

cb is not a function - when handling the unhandled Promise Rejection using winston

Getting the cb is not a function when I run this code to handle the uhandled Promise rejection using winston. In console it shwos exact error but it stores cb is not a function. winston.add(winston.transports.File, { filename:…
Ihtisham Tanveer
  • 338
  • 4
  • 15
-1
votes
2 answers

How do I redirect STDOUT to .json for logs in NodeJS

I need to have my logs in .json format and currently I use express-js server and my logs looks the following: Error: Cannot return null for non-nullable field Query.get_bar. Error: Cannot return null for non-nullable field Query.get_bar. Error:…
A. Karnaval
  • 727
  • 2
  • 8
  • 12
-1
votes
1 answer

Replacing comma by plus in javascript for entire project

I use winston to perform logging currently and have written a common method for it to be used all over project. Problem is, many of logging statements are like, logger.info("here is the data" , data) With comma as concatenator, i couldn't log data…
Gayathri
  • 1,776
  • 5
  • 23
  • 50
-1
votes
1 answer

Winston logging file name to a transport

I have the following logger module: const { createLogger, format, transports } = require('winston'); const { combine, timestamp, label, printf, colorize } = format; const logger = require('winston'); const { red } = require('colors') const myFormat…
Limbo
  • 623
  • 8
  • 24
-1
votes
1 answer

winston logger - unable to show colors for output

I recently stumbled upon winston logging and started to use in one of my nodejs applications. My configuration is below: // Setup winston logging var loggerSettings = { level: logConfig.dev.level, //format: combine(label({label: 'authServer'}),…
Mopparthy Ravindranath
  • 3,014
  • 6
  • 41
  • 78
-1
votes
1 answer

Local logging vs. using remote service

I have a web app, with node backend. I'm finishing the backend now and I was wondering what should I use for logging. Particularly, whether should I log locally or to some remote location, something like Loggly for example. The reason why I want to…
Maciej Krawczyk
  • 14,825
  • 5
  • 55
  • 67
-1
votes
1 answer

How to log every message in new line using winston logger?

we are using winston logger to log events to nodejs fs , i want to write every event into new line using winston, is it possible with to achieve that task using winston library or any other approach that works with nodejs. ctrl.js var winston =…
hussain
  • 6,587
  • 18
  • 79
  • 152
-1
votes
1 answer

How to archive log files after they reach certain size limit in Node JS using winston?

I am new to Node JS. I was looking for a logging library for Node and I found Winston. Now, I want to archive the log files once they reach certain size with the timestamp included in name. For ex: Current log file: logs/devlog.log(10 MB) since it…
user1840131
  • 11
  • 1
  • 6
1 2 3
62
63