From ebe5a869f2a3304d7ab3148bd39a8bfd023ff84c Mon Sep 17 00:00:00 2001 From: Aleksey Lim Date: Thu, 18 Dec 2008 08:49:43 +0000 Subject: use env variables to setup debug flags --- (limited to 'common/Config.py') diff --git a/common/Config.py b/common/Config.py index 72ae993..7fe8371 100644 --- a/common/Config.py +++ b/common/Config.py @@ -2,6 +2,7 @@ import os, sys, time from sugar.activity.activity import get_bundle_path, get_activity_root from sugar import env +import logging #QUICKLOAD = os.path.isfile("QUICKLOAD") # skip loading inessential comenents to speed things up @@ -17,21 +18,12 @@ if os.path.isfile("DEBUG"): if len(l): DEBUG = int( l ) else: DEBUG = 99 else: - DEBUG = 0 -print "Debug Level %d" % (DEBUG) - -# TODO: move this into a logging file in Util/ -# TODO: consider python's logging utility from the stdlib -def logwrite(level, msg): - global DEBUG - if level <= DEBUG: - if not hasattr(logwrite, 'file'): - logwrite.file = sys.stdout - print >> logwrite.file, 'L%i:%f: %s'% (level, time.time(), msg) - logwrite.file.flush() + DEBUG = int(os.getenv("TAMTAM_DEBUG", "0")) + +logging.debug("Debug Level %d" % (DEBUG)) TAM_TAM_ROOT = get_bundle_path() -print 'INFO: loaded TAMTAM_ROOT=%s' % TAM_TAM_ROOT +logging.debug('INFO: loaded TAMTAM_ROOT=%s' % TAM_TAM_ROOT) #PATHS if XO: @@ -55,7 +47,8 @@ for i in (INSTANCE_DIR, DATA_DIR, SNDS_INFO_DIR, TMP_DIR): if not os.path.isdir(i): os.makedirs(i) #PLUGIN -PLUGIN_DEBUG = "STDERR" +PLUGIN_DEBUG = os.getenv("CSOUND_LOGFILE") +if PLUGIN_DEBUG == "": PLUGIN_DEBUG = "STDERR" PLUGIN_VERBOSE = DEBUG PLUGIN_UNIVORC = os.path.join(FILES_DIR, "tamtamorc.csd") PLUGIN_KSMPS = 64 -- cgit v0.9.1