Package com.kosdev.kos.core.service.log
Class LogOverride
java.lang.Object
com.kosdev.kos.core.service.log.LogOverride
Log level override definition. Log overrides are scoped to node types.
That is, an override applied to a node type and all KOS nodes of that
type will have the override applied. This provides some granularity in
log overrides as they don't apply to the entire device.
The type property defines what the override applies to. Types are defined
as colon-separated strings that match a particular type of logging. For
example, java log overrides use the following types:
java:class: Applies the override to a particular java class or package.java:group: Applies the override to a particularLoggroup.
kos.logging iface can support
log overrides. To override log levels for a blink connection, the type should be
blink:{logType}, where the type is provided by the device as part of the
iface. This allows log overrides to be specified for each distinct blink
connection type.
Finally, the level is desired log level to apply and may be relative to the receiving logger implementation. In java the values should be the standard TRACE, DEBUG, INFO, WARN, FATAL values. For C or other languages, the level may be defined as needed.
When used with blink loggers, the log level is converted to a numeric value using
one of the LEVEL_XXX constants. Any string that doesn't match a known
level will be converted to LEVEL_INFO.
- Since:
- 1
- Version:
- 9
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final intstatic final intstatic final intstatic final intstatic final intstatic final intstatic final StringApply an override to a blink connection.static final StringApply an override to a java class or package.static final StringApply an override to a custom logging group. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionbooleangetLevel()The log level to use: TRACE, DEBUG, INFO, etc...static StringgetLevelName(int val) Return the log level name for the specified level value.static StringgetLevelName(String name) Return the normalized log level name for the specified level name.static intgetLevelVal(int val) Return the normalized log level value for the specified value.static intgetLevelVal(String name) Return the log level value for the specified level name.getName()The class / package / group name.The nodeType this override should apply to.getType()The type of override to apply.inthashCode()voidSet the level of the override.voidThe class / package / group name.voidsetNodeType(String nodeType) The nodeType this override should apply to.voidThe type of override to apply.toString()
-
Field Details
-
TYPE_JAVA_CLASS
Apply an override to a java class or package.- See Also:
-
TYPE_JAVA_GROUP
Apply an override to a custom logging group.- See Also:
-
TYPE_BLINK_PREFIX
Apply an override to a blink connection.- See Also:
-
LEVEL_FATAL
public static final int LEVEL_FATAL- See Also:
-
LEVEL_ERROR
public static final int LEVEL_ERROR- See Also:
-
LEVEL_WARN
public static final int LEVEL_WARN- See Also:
-
LEVEL_INFO
public static final int LEVEL_INFO- See Also:
-
LEVEL_DEBUG
public static final int LEVEL_DEBUG- See Also:
-
LEVEL_TRACE
public static final int LEVEL_TRACE- See Also:
-
-
Constructor Details
-
LogOverride
public LogOverride()
-
-
Method Details
-
setLevel
Set the level of the override. The supplied string will be converted to uppercase and mapped to one of the known levels. If there is no match, the value will be converted toINFO.- Since:
- 1
-
getLevelName
Return the log level name for the specified level value.- Since:
- 9
-
getLevelName
Return the normalized log level name for the specified level name.- Since:
- 9
-
getLevelVal
Return the log level value for the specified level name.- Since:
- 9
-
getLevelVal
public static int getLevelVal(int val) Return the normalized log level value for the specified value.- Since:
- 9
-
getNodeType
The nodeType this override should apply to. -
getType
The type of override to apply. One of the TYPE_XXX constants in this class. -
getName
The class / package / group name. -
getLevel
The log level to use: TRACE, DEBUG, INFO, etc... -
setNodeType
The nodeType this override should apply to. -
setType
The type of override to apply. One of the TYPE_XXX constants in this class. -
setName
The class / package / group name. -
equals
-
hashCode
public int hashCode() -
toString
-