Mercurial > hg > truffle
changeset 10923:01a0f525ac17
Debug: add printf
i.e., log without newline
author | Bernhard Urban <bernhard.urban@jku.at> |
---|---|
date | Thu, 01 Aug 2013 18:58:48 +0200 |
parents | 1d1675f18e85 |
children | f75695de1312 |
files | graal/com.oracle.graal.debug/src/com/oracle/graal/debug/Debug.java graal/com.oracle.graal.debug/src/com/oracle/graal/debug/internal/DebugScope.java |
diffstat | 2 files changed, 16 insertions(+), 0 deletions(-) [+] |
line wrap: on
line diff
--- a/graal/com.oracle.graal.debug/src/com/oracle/graal/debug/Debug.java Thu Aug 01 17:24:41 2013 +0200 +++ b/graal/com.oracle.graal.debug/src/com/oracle/graal/debug/Debug.java Thu Aug 01 18:58:48 2013 +0200 @@ -164,6 +164,12 @@ } } + public static void printf(String msg, Object... args) { + if (ENABLED && DebugScope.getInstance().isLogEnabled()) { + DebugScope.getInstance().printf(msg, args); + } + } + public static void dump(Object object, String msg, Object... args) { if (ENABLED && DebugScope.getInstance().isDumpEnabled()) { DebugScope.getInstance().dump(object, msg, args);
--- a/graal/com.oracle.graal.debug/src/com/oracle/graal/debug/internal/DebugScope.java Thu Aug 01 17:24:41 2013 +0200 +++ b/graal/com.oracle.graal.debug/src/com/oracle/graal/debug/internal/DebugScope.java Thu Aug 01 18:58:48 2013 +0200 @@ -114,6 +114,16 @@ } } + public void printf(String msg, Object... args) { + if (isLogEnabled()) { + if (lastLogScope.get() == null || !lastLogScope.get().qualifiedName.equals(this.qualifiedName)) { + output.println("scope: " + qualifiedName); + lastLogScope.set(this); + } + output.printf(msg, args); + } + } + public void dump(Object object, String formatString, Object[] args) { if (isDumpEnabled()) { DebugConfig config = getConfig();