From b184d8e7e13cddc72fb6762b2c78556a4a223f6a Mon Sep 17 00:00:00 2001 From: Nils Date: Mon, 10 Oct 2022 18:01:36 +0200 Subject: [PATCH] forward python logger settings across lss programs --- template/start.py | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/template/start.py b/template/start.py index 8d96f51..b1aa2de 100644 --- a/template/start.py +++ b/template/start.py @@ -46,9 +46,18 @@ parser.add_argument("-v", "--version", action='version', version="{} {}".format( parser.add_argument("-s", "--save", action='store', dest="directory", help="Use this directory to save. Will be created or loaded from if already present. Deactivates Agordejo/New-Session-Manager support.") parser.add_argument("-p", "--profiler", action='store_true', help="(Development) Run the python profiler and produce a .cprof file at quit. The name will appear in your STDOUT.") parser.add_argument("-m", "--mute", action='store_true', help="(Development) Use a fake cbox module, effectively deactivating midi and audio.") -parser.add_argument("-V", "--verbose", action='store_true', help="(Development) Switch the logger to INFO and print out all kinds of information to get a high-level idea of what the program is doing.") +parser.add_argument("-V", "--verbose", action='store_true', help="(Development) Switch the logger to INFO and print out all kinds of information to get a high-level idea of what the program is doing. You can also set the environment variable LSS_DEBUG=1") args = parser.parse_args() +#Check for an alternative way to enable the logger. +import os +if args.verbose: + os.environ["LSS_DEBUG"] = "1" #for children programs. +elif not args.verbose and os.getenv("LSS_DEBUG"): + args.verbose = True + + + import logging if args.verbose: #development logging.basicConfig(level=logging.INFO, format='[' + METADATA["shortName"] + '] %(levelname)s %(asctime)s %(name)s: %(message)s',)