-
Notifications
You must be signed in to change notification settings - Fork 1.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Bug]: cannot extend winston.logger #2170
Comments
same issue |
So, Logger is a class because of the latest version update - #2157 There's even a warning that it's not allowed: Lines 175 to 176 in acaa95b
Personally, I would like to extend the Logger as well. My purpose is providing default messages for common situations, for example: logEntityDeleted = (entity: EntityLike, additionalMetadata?: Record<string, unknown>): void => {
this.log({
level: 'audit',
message: `${entityToString(entity)}, was deleted`,
eventType: 'deleteEntity',
entity: entity.constructor.name,
entityId: entity.id,
entityName: entity?.name,
...additionalMetadata,
});
}; I think the fix is as simple as exporting the Logger class, though that warning shows that it's not exported intentionally. |
Having a similar issue with
Update: Fixed it by setting |
Not sure if I've understood correctly but I am able to extend from Transport class using the |
I got my specific problem fixed by by setting |
+1 |
This should be solved via #2181 and will go out in the next release |
🔎 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
The text was updated successfully, but these errors were encountered: