Mercurial > hg > truffle
diff graal/com.oracle.graal.debug/src/com/oracle/graal/debug/internal/DebugScope.java @ 13142:401830ff96f4
some improvements in Debug logging
author | Erik Eckstein <erik.eckstein@oracle.com> |
---|---|
date | Mon, 25 Nov 2013 13:41:18 +0100 |
parents | cb5df1879500 |
children | 1baa169508f5 |
line wrap: on
line diff
--- a/graal/com.oracle.graal.debug/src/com/oracle/graal/debug/internal/DebugScope.java Mon Nov 25 13:37:24 2013 +0100 +++ b/graal/com.oracle.graal.debug/src/com/oracle/graal/debug/internal/DebugScope.java Mon Nov 25 13:41:18 2013 +0100 @@ -75,7 +75,7 @@ } @Override - public Indent logIndent(String msg, Object... args) { + public Indent logAndIndent(String msg, Object... args) { log(msg, args); return indent(); } @@ -87,6 +87,11 @@ } return lastUsedIndent; } + + @Override + public void close() { + outdent(); + } } private static ThreadLocal<DebugScope> instanceTL = new ThreadLocal<>(); @@ -231,7 +236,6 @@ public <T> T scope(String newName, Runnable runnable, Callable<T> callable, boolean sandbox, DebugConfig sandboxConfig, Object[] newContext) { DebugScope oldContext = getInstance(); DebugConfig oldConfig = getConfig(); - boolean oldLogEnabled = oldContext.isLogEnabled(); DebugScope newChild = null; if (sandbox) { newChild = new DebugScope(newName, newName, null, newContext); @@ -240,6 +244,7 @@ newChild = oldContext.createChild(newName, newContext); } instanceTL.set(newChild); + newChild.setLogEnabled(oldContext.isLogEnabled()); newChild.updateFlags(); try { return executeScope(runnable, callable); @@ -247,7 +252,6 @@ newChild.context = null; instanceTL.set(oldContext); setConfig(oldConfig); - setLogEnabled(oldLogEnabled); } } @@ -283,7 +287,6 @@ meterEnabled = false; timeEnabled = false; dumpEnabled = false; - setLogEnabled(false); // Be pragmatic: provide a default log stream to prevent a crash if the stream is not // set while logging @@ -293,7 +296,9 @@ timeEnabled = config.isTimeEnabled(); dumpEnabled = config.isDumpEnabled(); output = config.output(); - setLogEnabled(config.isLogEnabled()); + if (config.isLogEnabled()) { + setLogEnabled(true); + } } }