Browse Source

forward python logger settings across lss programs

master
Nils 4 months ago
parent
commit
5fe01efb86
  1. 3
      template/calfbox/cbox.py
  2. 11
      template/start.py

3
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):

11
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',)

Loading…
Cancel
Save