Package org.ka2ddo.util
Class DebugCtl
java.lang.Object
org.ka2ddo.util.DebugCtl
This class manages the debug controls for the application, independent of how
the controls are set by any user interface. As such, code wanting to test the
debug controls to decide whether to output debug data can do so without being
locked to a particular application.
- Author:
- Andrew Pavlin, KA2DDO
-
Nested Class Summary
Modifier and TypeClassDescriptionstatic interface
Implementors of this interface, if registered with theaddDbgListener(DbgListener, String, String)
method, can be informed of dynamic changes in the debug flags. -
Method Summary
Modifier and TypeMethodDescriptionstatic void
addDbgListener
(DebugCtl.DbgListener l, String categoryName, String tagsToDisplayName) Register a listener for the specified categories of debug events.Get the list of known dynamically modifiable debug categories and their tags for locale-specific descriptions.Get the list of known dynamically modifiable debug categories and their tags for locale-specific descriptions.static String
getCategoryTag
(String category) Get the localization tag name for a description of the category.static boolean
isDebug()
Indicate if debug messages should be printed out.static boolean
Indicate if a specific category of debug messages should be printed out.static boolean
isDebugOnly
(String categoryName) Indicate if a specific category of debug messages should be printed out.static void
removeDbgListener
(DebugCtl.DbgListener l, String... categoryNames) Unregister a listener for the specified categories of debug events.static void
Specify if a specific category of debug messages should be printed out.
-
Method Details
-
setDebug
Specify if a specific category of debug messages should be printed out.- Parameters:
categoryName
- String name of category to enable debug logging forsetting
- boolean true or false to enable or disable debugging this category
-
isDebug
public static boolean isDebug()Indicate if debug messages should be printed out.- Returns:
- boolean true if debug messages should be printed
-
isDebug
Indicate if a specific category of debug messages should be printed out.- Parameters:
categoryName
- String name of category to enable debug logging for- Returns:
- boolean true if the named category of debug messages should be printed
-
isDebugOnly
Indicate if a specific category of debug messages should be printed out.- Parameters:
categoryName
- String name of category to enable debug logging for- Returns:
- boolean true if the named category of debug messages should be printed
-
addDbgListener
public static void addDbgListener(DebugCtl.DbgListener l, String categoryName, String tagsToDisplayName) Register a listener for the specified categories of debug events. If registered for the "all" category, such listeners will be informed of all debug changes and given the name of the category actually changed.- Parameters:
l
- DbgListener to register (or null to just register a type and description)categoryName
- String names of debug categories; null implies "all"tagsToDisplayName
- String tag name for displaying the categories for dynamic debug level switching from the UI
-
removeDbgListener
Unregister a listener for the specified categories of debug events.- Parameters:
l
- DbgListener to unregistercategoryNames
- array of String names of debug categories; zero-length implies an array of "all"
-
getCategoryCodesAndTagNames
Get the list of known dynamically modifiable debug categories and their tags for locale-specific descriptions.- Returns:
- read-only Set of Map.Entry of category ID to resource tag names
-
getCategorySettings
Get the list of known dynamically modifiable debug categories and their tags for locale-specific descriptions.- Returns:
- read-only Set of Map.Entry of category ID to resource tag names
-
getCategoryTag
Get the localization tag name for a description of the category.- Parameters:
category
- String category name- Returns:
- String tag for looking up localized description in ResourceBundles, or null if no known tag
-