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

Allow environment variables to control loglevels #1

Open
Yamboy1 opened this issue May 29, 2020 · 0 comments
Open

Allow environment variables to control loglevels #1

Yamboy1 opened this issue May 29, 2020 · 0 comments
Labels
good first issue Good for newcomers
Milestone

Comments

@Yamboy1
Copy link
Owner

Yamboy1 commented May 29, 2020

A very useful feature I think would be to allow someone to set the log level through an environment variable, even if it's just for debug. So you can do something like

$ DEBUG=1 deno script.ts

and it will print debug logs, overriding the settings in createLogger.

It's currently possible to do this by adding a ternary condition when instantiating the logger, however I feel this would be better off in the module itself

const logger = createLogger({
  minimumLevel: Deno.env.get("DEBUG") ? LogLevel.DEBUG : LogLevel.INFO
  outputFormat: textFormat
})

It would need to be toggleable through a setting (default to true ofc), maybe something like this:

const logger = createLogger({
  debugEnv: true, // This will allow you to use the DEBUG env variable
  minimumLevel: LogLevel.INFO
  outputFormat: textFormat
})
@Yamboy1 Yamboy1 added the good first issue Good for newcomers label May 29, 2020
@Yamboy1 Yamboy1 added this to the v1 milestone May 29, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
good first issue Good for newcomers
Projects
None yet
Development

No branches or pull requests

1 participant