[Bug]: cannot extend winston.logger
See original GitHub issue🔎 Search Terms
class extend, extend logger
The problem
TypeError: Class extends value undefined is not a constructor or null
What version of Winston presents the issue?
v3.8.1
What version of Node are you using?
v16.16.0
If this worked in a previous version of Winston, which was it?
No response
Minimum Working Example
import * as winston from 'winston'
class LogService extends winston.Logger {
private static instance: LogService
constructor () {
super({
level: process.env.LOG_LEVEL ?? 'info',
exitOnError: false,
format: winston.format.combine(winston.format.timestamp(), winston.format.json()),
})
}
static getInstance = (): LogService => {
if (LogService.instance == null) { LogService.instance = new LogService() }
return LogService.instance
}
}
export default LogService
Issue Analytics
- State:
- Created a year ago
- Reactions:3
- Comments:5 (1 by maintainers)
Top Results From Across the Web
Unable to inject winston's logger instance with NestJS
I'm trying to integrate Winston into NestJS, but so far, I'm unable to inject a logger instance (to actually log anything) into any ......
Read more >Node.js Logging with Winston - Reflectoring
Logging is used to provide accurate context about what occurs in our application, it is the documentation of all events that happen within ......
Read more >Node Logging Basics - The Ultimate Guide To Logging - Loggly
Winston can transport logs to an external location or query them when analyzing a problem. Vendor Libraries. Several log management vendors also supply...
Read more >Best Practices for Node.js Error-handling - Toptal
With that in mind, you should have no problem distinguishing between these ... It is a good decision to employ a customizable logger...
Read more >How to use PM2 for monitoring production Node JS applications
In the end, we'll have a working Node JS express app with logging and ... What problem does Winston solve that we can't...
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 Free
Top 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
same issue
I got my specific problem fixed by by setting
"esModuleInterop": true"
intsconfig.json
. Sorry for the late update.