Configurable log level: ENV + cmd

This commit is contained in:
Einar Forselv
2019-12-04 00:31:13 +01:00
parent 4ad575cfe3
commit 947a56b21e
3 changed files with 31 additions and 6 deletions

View File

@@ -16,6 +16,7 @@ logger = logging.getLogger(__name__)
def main():
"""CLI entrypoint"""
args = parse_args()
log.setup(level=args.log_level)
config = Config()
containers = RunningContainers()
@@ -132,6 +133,12 @@ def parse_args():
'action',
choices=['status', 'backup', 'start-backup-process'],
)
parser.add_argument(
'--log-level',
default=None,
choices=list(log.LOG_LEVELS.keys()),
help="Log level"
)
return parser.parse_args()