Skip to content

Support LOG_LEVEL expression #3

@JesusTheHun

Description

@JesusTheHun

Right now if you set LOG_LEVEL=debug you will only see debug statements.
Changes are, if you are debugging, you are also interested in errors, even warning, maybe info ? You get the gist.

I expected that setting the log level to info would also display all messages "above" info. Changing the current behaviour would be a breaking change, so what about expressions ?

# Ideas of syntaxes
LOG_LEVEL=info+ node ./app.js # info and anything above
LOG_LEVEL=debug:warning node ./app.js # anything between debug and warning, both included

# More verbose syntaxes but don't rely on a hierarchy
LOG_LEVEL="debug|info|warning|error" node ./app.js . # The pipe is a bash operator so we have to use quotes. But the pipe is a common operation for "or".
LOG_LEVEL=debug,info,warning,error node ./app.js # Doesn't need quotes, maybe less readable ?

If we allow to set multiple levels, we can actually allow any character that is not a letter as a separator.

I'm willing to submit a PR for this.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions