Resolve #16: Verbosity config should be levels not binary

Resolves: #16
This commit is contained in:
Scott Wallace 2020-10-26 11:36:52 +00:00
parent f46f99c1a2
commit 7496d5505e
3 changed files with 10 additions and 5 deletions

View file

@ -20,7 +20,7 @@ The following environment variables will override any config or default:
* GOTIFY_PORT (default: 80)
* GOTIFY_SERVER (default: localhost)
* LISTEN_PORT (default: 8080)
* VERBOSE (default: False)
* VERBOSE (default: 0)
```

View file

@ -59,9 +59,14 @@ if __name__ == '__main__':
# forwarder = alertify.Alertify(args.config)
forwarder = alertify.Alertify()
if forwarder.config.verbose:
logger = logging.getLogger()
logger.setLevel(logging.DEBUG)
#-----------------------------
# Calculate logging level
#-----------------------------
# Config :: Verbose: 0 = WARNING, 1 = INFO, 2 = DEBUG
# Logging :: Loglevel: 30 = WARNING, 20 = INFO, 10 = DEBUG
logger = logging.getLogger()
logger.setLevel(30 - (forwarder.config.verbose * 10))
#-----------------------------
if args.healthcheck:
# Invert the sense of 'healthy' for Unix CLI usage

View file

@ -21,7 +21,7 @@ class Config:
gotify_port = int(80)
gotify_server = str('localhost')
listen_port = int(8080)
verbose = bool(False)
verbose = int(0)
def __init__(self, configfile=None):
"""