Skip to content

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

@quickdraw6906

Description

@quickdraw6906

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)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions