diff options
author | Sven Gothel <[email protected]> | 2015-03-05 07:14:04 +0100 |
---|---|---|
committer | Sven Gothel <[email protected]> | 2015-03-05 07:14:04 +0100 |
commit | 72d3635279ffc8ad88e47dff9bbe95d211226d11 (patch) | |
tree | 62b3735680dfc5980a94afa14c56045bd082af24 /src/java/com/jogamp/gluegen/Logging.java | |
parent | dd2440cbadc642a561d8f92c502fe822b2f11762 (diff) |
Bug 1134 - Enhance GlueGen Compiler: Minimal GL Header Changes _and_ Typesafety
- We shall be able to import 'most' vanilla GL header,
i.e. only change the typedef part using our GlueGen types
- Type Safety:
- GlueGen now detects '#define' and 'enum' redefines
and throw an exception in this case.
This helps detecting wrongly renamed GL extensions into core!
- GlueGen now detects function redefines (overloading)
and throw an exception in this case.
Hence the semantics of duplicate functions has to be equal!
This helps detecting wrongly renamed GL extensions into core!
- Semantic equality for all types is provided
via interface TypeComparator.SemanticEqualityOp, i.e. 'boolean equalSemantics(..)'
implemented by com.jogamp.gluegen.cgram.types.Type.
Semantic equality can be relaxed via config "RelaxedEqualSemanticsTest true",
i.e. ignoring integer size, and const / volatile qualifiers.
- All equality/hash methods of 'com.jogamp.gluegen.cgram.types.*'
are restructured.
- Track and simplify renamed 'symbol', i.e. use a common
sub-interface for all renamed symbols (ConstantDefinition, FunctionSymbol, ..)
- This is provided in a unified manner
via interface com.jogamp.gluegen.cgram.types.AliasedSymbol
and its common implementation AliasedSymbolImpl
- All JavaConfiguration.shouldIgnore* methods operate w/
'AliasedSymbol' trying to match all aliases.
- Support 'struct NAME [ { ... } ]' w/o typedef's
- New GL / CL headers do not use typedef's for anonymous opaque types
- Opaque Type handling
- JavaConfiguration.typeInfo(..), identifying opaque types,
no more back references from target-type -> typedef.
Hence the following is possible now:
typedef void * Opaque01; // Opaque
typedef void * APointerBuffer; // A Buffer
- All Logger instances are no more static
and derive their warning level from the package's root Logger
via Logging.getLogger(..).
Diffstat (limited to 'src/java/com/jogamp/gluegen/Logging.java')
-rw-r--r-- | src/java/com/jogamp/gluegen/Logging.java | 32 |
1 files changed, 29 insertions, 3 deletions
diff --git a/src/java/com/jogamp/gluegen/Logging.java b/src/java/com/jogamp/gluegen/Logging.java index 40eadcb..77856f4 100644 --- a/src/java/com/jogamp/gluegen/Logging.java +++ b/src/java/com/jogamp/gluegen/Logging.java @@ -33,6 +33,7 @@ package com.jogamp.gluegen; import java.util.logging.ConsoleHandler; import java.util.logging.Formatter; +import java.util.logging.Handler; import java.util.logging.Level; import java.util.logging.LogRecord; import java.util.logging.Logger; @@ -41,11 +42,13 @@ import com.jogamp.common.util.PropertyAccess; /** * - * @author Michael Bien + * @author Michael Bien, et.al. */ public class Logging { - static void init() { + final static Logger rootPackageLogger; + + static { final String packageName = Logging.class.getPackage().getName(); final String property = PropertyAccess.getProperty(packageName+".level", true); Level level; @@ -64,12 +67,35 @@ public class Logging { handler.setFormatter(new PlainLogFormatter()); handler.setLevel(level); - final Logger rootPackageLogger = Logger.getLogger(packageName); + rootPackageLogger = Logger.getLogger(packageName); rootPackageLogger.setUseParentHandlers(false); rootPackageLogger.setLevel(level); rootPackageLogger.addHandler(handler); } + /** provokes static initialization */ + static void init() { } + + /** Returns the <i>root package logger</i>. */ + public static Logger getLogger() { + return rootPackageLogger; + } + /** Returns the demanded logger, while aligning its log-level to the root logger's level. */ + public static synchronized Logger getLogger(final String name) { + final Logger l = Logger.getLogger(name); + alignLevel(l); + return l; + } + /** Align log-level of given logger to the root logger's level. */ + public static void alignLevel(final Logger l) { + final Level level = rootPackageLogger.getLevel(); + l.setLevel(level); + final Handler[] hs = l.getHandlers(); + for(final Handler h:hs) { + h.setLevel(level); + } + } + /** * This log formatter needs usually one line per log record. * @author Michael Bien |