Closed MichaelFlucher closed 10 months ago
Hi Michael,
Please excuse my delayed response.
The problem is caused by an unassigned rootLogger
parameter when creating the winston transport.
As you can see here, the rootLogger
gets only assigned, when no options are given.
The idea is to allow specifying other Logger
instances, if needed. However, the logic does not ensure that the rootLogger
gets set in all cases. This can and should be improved.
Furthermore, the options
parameter is mandatory, which causes errors if it is not specified. Making it optional would also improve the situation.
To mitigate the problem, you can provide a null
value to the options
parameter. This ensures that the rootLogger gets assigned properly:
import log, { Level, Framework } from "cf-nodejs-logging-support";
log.createWinstonTransport(null)
I will work on a fix asap.
Thanks @christiand93 for the hint, I didn't even think of passing null
.
For now I got it to work with the following lines:
import log from "cf-nodejs-logging-support";
import * as winston from "winston";
// for the transports of winston, as there is a missing overlap reported by typescript
log.createWinstonTransport(null) as unknown as winston.transport
The fix is merged and will be shipped with version 7.2.1.
How should the Transport for winston be created with v7? The old way with
does not work anymore, so i tried it with empty options:
This gives the following error on the BTP: