You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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)
The text was updated successfully, but these errors were encountered:
sokki
added a commit
to sokki/winston
that referenced
this issue
Jun 20, 2023
It was typed as `LogEntry` which requires both `level` and `message` to be set. That contradicts the implementation that treats these fields as optional.
fixeswinstonjs#1969
It was typed as `LogEntry` which requires both `level` and `message` to be set. That contradicts the implementation that treats these fields as optional.
fixeswinstonjs#1969
…2314)
It was typed as `LogEntry` which requires both `level` and `message` to be set. That contradicts the implementation that treats these fields as optional.
fixes#1969
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)
The text was updated successfully, but these errors were encountered: