teamhephy / controller

Hephy Workflow Controller (API)
https://teamhephy.com
MIT License
14 stars 26 forks source link

enh(controller): Make log level configurable #126

Closed jfuechsl closed 3 years ago

jfuechsl commented 4 years ago

This PR introduces an env var LOG_LEVEL which sets the logging level of the controller. I will open a PR to add the var to the docs once this is ok'd.

Cryptophobia commented 4 years ago

I'm not sure there is any improvement to the current way the log level is configured here...?

There are only two modes in django, either DEBUG or INFO. Default should be INFO level.

jfuechsl commented 4 years ago

Yeah, I see your point. Setting DEBUG would set the root logger level to DEBUG and propagate it down to the child loggers. The other (for me more important change) is to set the formatter of the console logger to verbose (from simple). Is this something you would approve of?

Cryptophobia commented 4 years ago

@jfuechsl , so the question is if we want to use simple log format vs. verbose format?

LOGGING = {
    'version': 1,
    'disable_existing_loggers': False,
    'formatters': {
        'verbose': {
            'format': '{levelname} {asctime} {module} {process:d} {thread:d} {message}',
            'style': '{',
        },
        'simple': {
            'format': '{levelname} {message}',
            'style': '{',
        },

I'm not sure asctime, module, process:d, thread:d are a big benefit... I think maybe module is the biggest benefit because it can tell us which parts of the API the error or info message is coming from?

If you change it to verbose I am not opposed to the change... @kingdonb @felixbuenemann what do you guys think?

jfuechsl commented 4 years ago

We could introduce a LOG_VERBOSE env var which switches the logging to verbose and otherwise defaults to simple?

Cryptophobia commented 4 years ago

We could introduce a LOG_VERBOSE env var which switches the logging to verbose and otherwise defaults to simple?

I like it. That would be the best configurable route to allow for customizing the logs and keep it backwards compatible as a default.

Can you also change the commit msg to chore(... or feat(...?

enh(... is not really supported by our parser here: https://docs.teamhephy.com/contributing/submitting-a-pull-request/#commit-style

jfuechsl commented 4 years ago

I created #131 which supersedes this one. When can close this.

Cryptophobia commented 3 years ago

Closing this in favor of https://github.com/teamhephy/controller/pull/131