-
Notifications
You must be signed in to change notification settings - Fork 1.8k
Description
Documentation states:
All profile messages are set to 'info' level by default, and both message and metadata are optional. For individual profile messages, you can override the default log level by supplying a metadata object with a level property:
logger.profile('test', { level: 'debug' });`
But that gives error:
Argument of type '{ level: string; }' is not assignable to parameter of type 'LogEntry'.
Property 'message' is missing in type '{ level: string; }' but required in type 'LogEntry'.ts(2345)
Confirming:
import { LogEntry } from "winston"; let options: LogEntry = { level: "debug" };
Property 'message' is missing in type '{ level: string; }' but required in type 'LogEntry'.ts(2741)
If LogEntry requires message, that's fine, but then we should be able to do this:
logger.profile({ level: "debug", message: message });
Since this seems redundant (but works):
logger.profile(message, { level: "debug", message: message });
But not passing a string as first param gives:
Argument of type '{ level: string; message: string; }' is not assignable to parameter of type 'string | number'.
Type '{ level: string; message: string; }' is not assignable to type 'number'.ts(2345)