aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlon Zakai <alonzakai@gmail.com>2013-06-17 12:21:32 -0700
committerAlon Zakai <alonzakai@gmail.com>2013-06-17 12:21:32 -0700
commit697408d658f185991521946a3a68c8f2ce5d108d (patch)
treeeaa1c25dd3a2ddc742a9ef6abc46ccd49c985e22
parent6d16097a437b58c7e5451128658044998fa1da9d (diff)
enable all debug logging in emcc -v
-rwxr-xr-xemcc8
-rw-r--r--tools/shared.py9
2 files changed, 11 insertions, 6 deletions
diff --git a/emcc b/emcc
index 2a7e10d0..9849e881 100755
--- a/emcc
+++ b/emcc
@@ -53,8 +53,6 @@ from tools import shared
from tools.shared import Compression, execute, suffix, unsuffixed, unsuffixed_basename
from tools.response_file import read_response_file
-logging = logging.getLogger('emcc')
-
# Mapping of emcc opt levels to llvm opt levels. We use llvm opt level 3 in emcc opt
# levels 2 and 3 (emcc 3 is unsafe opts, so unsuitable for the only level to get
# llvm opt level 3, and speed-wise emcc level 2 is already the slowest/most optimizing
@@ -819,8 +817,12 @@ try:
newargs[i] = ''
elif newargs[i] == '-v':
shared.COMPILER_OPTS += ['-v']
- DEBUG = 1
os.environ['EMCC_DEBUG'] = '1' # send to child processes too
+ if DEBUG != 1:
+ # swap in debug logging
+ DEBUG = 1
+ shared.set_logging()
+ logging.debug('invocation: ' + ' '.join(sys.argv))
newargs[i] = ''
elif newargs[i].startswith('--shell-file'):
check_bad_eq(newargs[i])
diff --git a/tools/shared.py b/tools/shared.py
index 0d1cfffd..5571efea 100644
--- a/tools/shared.py
+++ b/tools/shared.py
@@ -454,9 +454,12 @@ EMSCRIPTEN_TEMP_DIR = configuration.EMSCRIPTEN_TEMP_DIR
DEBUG_CACHE = configuration.DEBUG_CACHE
CANONICAL_TEMP_DIR = configuration.CANONICAL_TEMP_DIR
-level = logging.DEBUG if os.environ.get('EMCC_DEBUG') else logging.INFO
-logging.basicConfig(level=level, format='%(levelname)-8s %(name)s: %(message)s')
-
+logging.basicConfig(format='%(levelname)-8s %(name)s: %(message)s')
+def set_logging():
+ logger = logging.getLogger()
+ logger.setLevel(logging.DEBUG if os.environ.get('EMCC_DEBUG') else logging.INFO)
+set_logging()
+
if not EMSCRIPTEN_TEMP_DIR:
EMSCRIPTEN_TEMP_DIR = tempfile.mkdtemp(prefix='emscripten_temp_', dir=configuration.TEMP_DIR)
def clean_temp():