public final class AdditionalLogItem extends Object
Log items comprise of a source class, a key, and an optional value. If no
value is present then only the key will be displayed in the log, otherwise
both the key and value will usually be displayed using the format
key=value
. Log item values are Object
instances whose string
representation will be derived using the object's toString()
method.
Log implementations may use the source class and/or key in order to filter out unwanted log items.
Modifier and Type | Method and Description |
---|---|
String |
getKey()
Returns the log item key.
|
Class<?> |
getSource()
Returns the class which generated the additional log item.
|
Object |
getValue()
Returns the log item value, or
null if this log item does not have
a value. |
boolean |
isQuoted()
Returns
true if this item's value should be surrounded by quotes
during serialization. |
static AdditionalLogItem |
keyOnly(Class<?> source,
String key)
Creates a new additional log item using the provided source and key, but no
value.
|
static AdditionalLogItem |
quotedKeyValue(Class<?> source,
String key,
Object value)
Creates a new additional log item using the provided source, key, and
value.
|
String |
toString() |
StringBuilder |
toString(StringBuilder builder)
Appends the string representation of this additional log item to the
provided string builder.
|
static AdditionalLogItem |
unquotedKeyValue(Class<?> source,
String key,
Object value)
Creates a new additional log item using the provided source, key, and
value.
|
public static AdditionalLogItem keyOnly(Class<?> source, String key)
source
- The class which generated the additional log item.key
- The log item key.public static AdditionalLogItem quotedKeyValue(Class<?> source, String key, Object value)
source
- The class which generated the additional log item.key
- The log item key.value
- The log item value.public static AdditionalLogItem unquotedKeyValue(Class<?> source, String key, Object value)
source
- The class which generated the additional log item.key
- The log item key.value
- The log item value.public Class<?> getSource()
public Object getValue()
null
if this log item does not have
a value.null
if this log item does not have
a value.public boolean isQuoted()
true
if this item's value should be surrounded by quotes
during serialization.true
if this item's value should be surrounded by quotes
during serialization.public StringBuilder toString(StringBuilder builder)
builder
- The string builder.Copyright © 2010-2017 ForgeRock AS. All Rights Reserved.