padLevels warning appears in Winston@3
See original GitHub issuePlease tell us about your environment:
- _
winston
version?-
winston@2
- [ x]
winston@3
-
- _
node -v
outputs: v14.13.1 - _Operating System: Linux
- _Language: ES6
What is the problem?
padLevels warning (“Accessing non-existent property ‘padLevels’ of module exports inside circular dependency”) appears when using Winston 3.3.3. Issue has been mostly related to Winston@2
What do you expect to happen instead?
padLevels does not occur
Other information
Logger is created as so
var appRoot = require('app-root-path');
var winston = require('winston');
const colorizer = winston.format.colorize();
// define the custom settings for each transport (file, console)
var options = {
console: {
handleExceptions: true,
level: "info",
format: winston.format.combine(
winston.format.timestamp({format: "HH:mm:ss"}),
winston.format.simple(),
winston.format.printf(msg =>
colorizer.colorize(msg.level, `${msg.timestamp} - ${msg.level}: ${msg.message}`)
),
)
},
};
// instantiate a new Winston Logger with the settings defined above
const logger = new winston.createLogger({
transports: [
new winston.transports.Console(options.console)
],
exitOnError: false, // do not exit on handled exceptions
});
// create a stream object with a 'write' function that will be used by `morgan`
logger.stream = {
write: function(message, encoding) {
// use the 'info' log level so the output will be picked up by both transports (file and console)
logger.info(message);
},
};
module.exports = logger;
A line such as logger.info("NPM package " + viewEngineData.expressName + " installed")
will cause the warning.
unsure if my Winston setup is wrong but seem to be using only Winston3 functions
Issue Analytics
- State:
- Created 3 years ago
- Reactions:3
- Comments:8
Top Results From Across the Web
Accessing non-existent property 'padLevels' of module exports ...
(node:4909) Warning: Accessing non-existent property 'padLevels' of module exports inside circular dependency (Use `node --trace-warnings .
Read more >logging in JavaScript with Winston.js - ZetCode
Winston tutorial shows how to do logging in JavaScript with Winston.js, and demonstrates logging in several code examples.
Read more >foreverjs/forever - Gitter
(node:733992) Warning: Accessing non-existent property 'padLevels' of module exports inside circular dependency. Igor Savin. @kibertoad. This is a Winston ...
Read more >winston - npm
Console({ level: 'warn' }), file: new winston.transports.File({ filename: 'combined.log', ...
Read more >Accessing non-existent property 'count' of module exports ...
(node:10624) Warning: Accessing non-existent property 'count' of module exports ... with these dependencies the same error is showing again.
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
We also get this in winston@2.4.4. This patch suppresses the warning:
Yeah, switch to Pino 😦