nest-winston
nest-winston copied to clipboard
How can we pass winston instance to nest-winston?
I did not find a way to do that, I want to use some winston features. We can provide winstonInstance to express-winston (similar library: https://github.com/bithavoc/express-winston), I am looking for such kind of property or anything else which can help me.
Hello, you mean you want to access the underlying winston instance? Can you provide an example of what you are trying to achive?
Hello, I think I understand the request as I have the same need right now.
In my case, I would like to provide to the function WinstonModule.createLogger({...})
an actual instance of Winston instead of the options needed to create a new one. So, this would mean:
WinstonModule.createLogger({
winstonInstance: myWinstonInstance
})
This what express-winston linked above allows.
My main reason for that is the following: I need some way to access the Winston instance in order to update the level
field. The goal is to allow to change the "minimum" level of logs at runtime in order to ease the debug in production. The easiest seems to create the Winston instance beforehand and keep it in a variable before giving it to WinstonModule, so that we can still interact with it.
What do you think ?
Hi - I was trying to use this new feature and realised the instance
parameter was being ignore when using either forRoot
or forRootAsync
.
I've opened a PR to modify the behaviour.
Does this look ok? Or have I misunderstood the desired behaviour?
This issue is stale because it has been open 30 days with no activity. Remove stale label or comment or this will be closed in 7 days.
This issue was closed because it has been stalled for 7 days with no activity.