Browse Source

forward python logger settings across lss programs

master
Nils 2 years ago
parent
commit
b184d8e7e1
  1. 11
      template/start.py

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