When configuring custom log levels in TypeScript:
log4js.configure({
levels: {
VERBOSE: { value: 10500, colour: 'cyan' },
SILLY: { value: 4500, colour: 'blue' },
},
appenders: {
console: { type: 'console', layout },
},
categories: {
testApp: { appenders: ['console'], level: 'info' },
default: { appenders: ['console'], level: 'info' },
},
});
const log = log4js.getLogger('testApp');
log.level = 'silly';
log.debug('test 123');
log.verbose('asdf');
log.silly('asdfasdfasdf');
I get the following type errors:
On the configuration object:
No overload matches this call.
Overload 1 of 2, '(filename: string): Log4js', gave the following error.
Argument of type '{ levels: { VERBOSE: { value: number; colour: string; }; SILLY: { value: number; colour: string; }; }; appenders: { console: { type: string; }; }; categories: { testApp: { appenders: string[]; level: string; }; default: { ...; }; }; }' is not assignable to parameter of type 'string'.
Overload 2 of 2, '(config: Configuration): Log4js', gave the following error.
Type '{ VERBOSE: { value: number; colour: string; }; SILLY: { value: number; colour: string; }; }' is not assignable to type 'Levels'.
Object literal may only specify known properties, and 'VERBOSE' does not exist in type 'Levels'.ts(2769)
log4js.d.ts(409, 3): The expected type comes from property 'levels' which is declared here on type 'Configuration'
On the Logger object:
Property 'verbose' does not exist on type 'Logger'.ts(2339)
Property 'silly' does not exist on type 'Logger'.ts(2339)
The code actually works, but the type errors are flagged by the IDE -- vscode in my case.
When configuring custom log levels in TypeScript:
I get the following type errors:
On the configuration object:
On the Logger object:
The code actually works, but the type errors are flagged by the IDE -- vscode in my case.