I am working on a node application and using Typescript. I have winston 3. In my code I have added custom log levels;
const myCustomLevels = {
levels: {
data: 10,
protocol: 9,
debug: 8,
info: 7,
notice: 6,
note: 5,
warn: 4,
error: 3,
crit: 2,
alert: 1,
emerg: 0,
}
}
then
const logger = winston.createLogger({
level: data,
levels: myCustomLevels.levels,
format: winston.format.combine(
winston.format.json()
),
transports: [new winston.transports.Console()],
});
The problem I need help with is when I use the logger Typescript complains.
logger.protocol({});
in this case the types are const logger: winston.Logger and the ts says [ts] Property 'protocol' does not exist on type 'Logger'. [2339].
Typescript doesn't know about my levels.
How do I correct this so that tsc knows about my levels on the logger?