public final class DebugTools extends Object
Modifier and Type | Method and Description |
---|---|
static boolean |
enableIJLogging(boolean debug)
Enable SLF4J logging using logback, in the context of ImageJ.
|
static boolean |
enableLogging()
Attempts to enable SLF4J logging via logback or log4j.
|
static boolean |
enableLogging(String level)
Attempts to enable SLF4J logging and set the root logger level.
|
static String |
getFieldName(Class<?> c,
int value)
This method uses reflection to scan the values of the given class's
static fields, returning the first matching field's name.
|
static String |
getStackTrace(Throwable t)
Extracts the given exception's corresponding stack trace to a string.
|
static boolean |
isEnabled()
Checks whether SLF4J logging has been enabled via logback or log4j.
|
static void |
setRootLevel(String level)
Sets the root logger level.
|
public static String getStackTrace(Throwable t)
t
- the Throwable from which to extract a stack tracepublic static boolean isEnabled()
true
if logging has been successfully enabledpublic static void setRootLevel(String level)
level
- A string indicating the desired levelpublic static boolean enableLogging()
isEnabled()
.true
if logging was successfully enabled by this methodpublic static boolean enableLogging(String level)
enableLogging()
. If this method returns true
, the root
logger level is also set via setRootLevel(String)
using the
input level.level
- A string indicating the desired leveltrue
if logging was successfully enabled by this methodpublic static boolean enableIJLogging(boolean debug)
debug
- true if debug-level output should be shownpublic static String getFieldName(Class<?> c, int value)
c
- the class to scanvalue
- the int value of the field to findvalue
if a matching field is not foundCopyright © 2005–2024 Open Microscopy Environment. All rights reserved.