diff --git a/README.md b/README.md index 13ba164..1e8a3fe 100644 --- a/README.md +++ b/README.md @@ -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) ``` diff --git a/alertify.py b/alertify.py index 1579446..906477a 100644 --- a/alertify.py +++ b/alertify.py @@ -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 diff --git a/src/alertify/config.py b/src/alertify/config.py index 948eab6..155e5f7 100644 --- a/src/alertify/config.py +++ b/src/alertify/config.py @@ -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): """