Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Doc bug for profile(), or missing implementation #1969

Closed
quickdraw6906 opened this issue Nov 18, 2021 · 0 comments · Fixed by #2314
Closed

Doc bug for profile(), or missing implementation #1969

quickdraw6906 opened this issue Nov 18, 2021 · 0 comments · Fixed by #2314

Comments

@quickdraw6906
Copy link

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)

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.

fixes winstonjs#1969
sokki added a commit to sokki/winston that referenced this issue Jun 26, 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.

fixes winstonjs#1969
DABH pushed a commit that referenced this issue Jun 28, 2023
…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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant