summaryrefslogtreecommitdiffstats
path: root/src/java/com/jogamp/gluegen/Logging.java
diff options
context:
space:
mode:
authorSven Gothel <[email protected]>2015-03-08 09:00:08 +0100
committerSven Gothel <[email protected]>2015-03-08 09:00:08 +0100
commit457355003bff320eee831731de016d29fb1e3982 (patch)
treeff3a257a8d2e083813f1499b906687576eddb558 /src/java/com/jogamp/gluegen/Logging.java
parentda909f84dc8421052c92491baa7dd90e1c78dc8f (diff)
Bug 1134 - Logging's formatter now takes care of Type -> getDebugString() when desired, not at 'log' call
Removes load to assemble the getDebugString() of Type and JavaType when invoking log function. Note: the log may be skipped if log-level is not reached.
Diffstat (limited to 'src/java/com/jogamp/gluegen/Logging.java')
-rw-r--r--src/java/com/jogamp/gluegen/Logging.java13
1 files changed, 13 insertions, 0 deletions
diff --git a/src/java/com/jogamp/gluegen/Logging.java b/src/java/com/jogamp/gluegen/Logging.java
index f1ba39b..f57c485 100644
--- a/src/java/com/jogamp/gluegen/Logging.java
+++ b/src/java/com/jogamp/gluegen/Logging.java
@@ -41,6 +41,7 @@ import java.util.logging.LogRecord;
import java.util.logging.Logger;
import com.jogamp.common.util.PropertyAccess;
+import com.jogamp.gluegen.cgram.types.Type;
/**
*
@@ -224,6 +225,18 @@ public class Logging {
public void setASTLocusTag(final ASTLocusTag loc) { astLocus = loc; }
@Override
public String format(final LogRecord record) {
+ // Replace [Type, JavaType] -> its debug string!
+ final Object[] params = record.getParameters();
+ if( null != params ) {
+ for(int i=params.length-1; 0<=i; i--) {
+ final Object o = params[i];
+ if( o instanceof Type ) {
+ params[i] = ((Type)o).getDebugString();
+ } else if( o instanceof JavaType ) {
+ params[i] = ((JavaType)o).getDebugString();
+ }
+ }
+ }
final StringBuilder sb = new StringBuilder(256);
if( null != astLocus ) {
astLocus.toString(sb, getCanonicalName(record.getLevel())).append(": ");