From 50d0d5a54f4a48da119dd6749786f6d0c41e6a39 Mon Sep 17 00:00:00 2001 From: Nils Date: Mon, 10 Oct 2022 18:01:32 +0200 Subject: [PATCH] forward python logger settings across lss programs --- template/calfbox/cbox.py | 3 +++ template/start.py | 11 ++++++++++- 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/template/calfbox/cbox.py b/template/calfbox/cbox.py index 1b2fbff..0f78339 100644 --- a/template/calfbox/cbox.py +++ b/template/calfbox/cbox.py @@ -879,6 +879,7 @@ class DocInstrument(DocObj): self.output_slots.append(io) def move_to(self, target_scene, pos = 0): return self.cmd_makeobj("/move_to", target_scene.uuid, pos + 1) + def get_output_slot(self, slot): return self.output_slots[slot] Document.classmap['cbox_instrument'] = DocInstrument @@ -1125,6 +1126,8 @@ class SamplerProgram(DocObj): return self.get_thing("/control_labels", '/control_label', {int : str}) def get_key_labels(self): return self.get_thing("/key_labels", '/key_label', {int : str}) + def get_output_labels(self): + return self.get_thing("/output_labels", '/output_label', {int : str}) def get_keyswitch_groups(self): return self.get_thing("/keyswitch_groups", '/key_range', [(int, int)]) def new_group(self): 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',)