DailyRotateFileTransport class is not a constructor
See original GitHub issueimport winston, { format } from 'winston';
import 'winston-daily-rotate-file';
const { combine, timestamp, prettyPrint } = format;
const logger = winston.createLogger({
format: combine(
timestamp(),
prettyPrint()
),
transports: [
new winston.transports.DailyRotateFileTransport({
dirname: './logs/errors',
filename: 'error.%DATE%.log',
datePattern: 'HH:mm'
})
]
});
Whether I declare a transport object of DailyRotateFileTransport class, I get an error
new winston_1.default.transports.DailyRotateFileTransport({
^
TypeError: winston_1.default.transports.DailyRotateFileTransport is not a constructor
Could you tell me if it happens because of using typescript or there is another reason?
Issue Analytics
- State:
- Created 4 years ago
- Comments:5 (3 by maintainers)
Top Results From Across the Web
NodeJS Logger: winston.transports.DailyRotateFile is not a ...
I had to do this so it would work: var winston = require('winston'), expressWinston = require('express-winston'); winston.transports.
Read more >winston-daily-rotate-file - npm
A transport for winston which logs to a rotating file each day.. Latest version: 4.7.1, last published: 7 months ago.
Read more >How to use Winston Daily Rotate File Logger in NodeJs
const transport = new (winston.transports. ... Winston daily rotate file ensure that we do not have all log being written in single file....
Read more >Node.js Logging with Winston - Reflectoring
If we do not explicitly state our winston logging level, ... winston-daily-rotate-file is a transport maintained by winston contributors.
Read more >Winston - Best of JS
transports, [] (No transports), Set of logging targets for info messages ... class YourCustomTransport extends Transport { constructor(opts) { super(opts); ...
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
you shoule chage the import statement .
my winston-daily-rotate-file’ version is
^4.5.1
.The same thing. But I have found a solution in