public abstract class AbstractJsonLogger extends Object implements JsonLogger
| Modifier and Type | Field and Description |
|---|---|
protected org.slf4j.Logger |
slf4jLogger |
| Constructor and Description |
|---|
AbstractJsonLogger(org.slf4j.Logger slf4jLogger,
org.apache.commons.lang3.time.FastDateFormat formatter,
com.google.gson.Gson gson,
boolean includeLoggerName) |
| Modifier and Type | Method and Description |
|---|---|
JsonLogger |
exception(String key,
Exception exception)
Add an exception to the JSON hierarchy.
|
JsonLogger |
field(String key,
Object value)
Add a top level field.
|
JsonLogger |
field(String key,
java.util.function.Supplier value)
Add a top level field as a lambda or supplier that is lazily evaluated only if the message is logged.
|
protected String |
formatMessage(String level) |
JsonLogger |
json(String key,
com.google.gson.JsonElement jsonElement)
Add an arbitrary JsonElement object to the top level with the given key.
|
JsonLogger |
json(String key,
java.util.function.Supplier<com.google.gson.JsonElement> jsonElement)
Add an arbitrary JsonElement object to the top level with the given key that is lazily evaluated only if the message is logged
|
JsonLogger |
list(String key,
List list)
Add a list to the JSON hierarchy
|
JsonLogger |
list(String key,
java.util.function.Supplier<List> list)
Add a list to the JSON hierarchy as a lambda or supplier that is lazily evaluated only if the message is logged
|
abstract void |
log()
Log the formatted message
|
JsonLogger |
map(String key,
Map map)
Add a map to the JSON hierarchy
|
JsonLogger |
map(String key,
java.util.function.Supplier<Map> map)
Add a map to the JSON hierarchy as a lambda or supplier that is lazily evaluated only if the message is logged
|
JsonLogger |
message(String message)
Set top level message field.
|
JsonLogger |
message(java.util.function.Supplier<String> message)
Set top level message field as a lambda or supplier that is lazily evaluated only if the message is logged
|
JsonLogger |
stack()
Include the stack dump of the current running thread in the log output.
|
public AbstractJsonLogger(org.slf4j.Logger slf4jLogger,
org.apache.commons.lang3.time.FastDateFormat formatter,
com.google.gson.Gson gson,
boolean includeLoggerName)
public JsonLogger message(String message)
JsonLoggermessage in interface JsonLoggerpublic JsonLogger message(java.util.function.Supplier<String> message)
JsonLoggermessage in interface JsonLoggerpublic JsonLogger map(String key, Map map)
JsonLoggermap in interface JsonLoggerpublic JsonLogger map(String key, java.util.function.Supplier<Map> map)
JsonLoggermap in interface JsonLoggerpublic JsonLogger list(String key, List list)
JsonLoggerlist in interface JsonLoggerpublic JsonLogger list(String key, java.util.function.Supplier<List> list)
JsonLoggerlist in interface JsonLoggerpublic JsonLogger field(String key, Object value)
JsonLoggerfield in interface JsonLoggerpublic JsonLogger field(String key, java.util.function.Supplier value)
JsonLoggerfield in interface JsonLoggerpublic JsonLogger json(String key, com.google.gson.JsonElement jsonElement)
JsonLoggerjson in interface JsonLoggerpublic JsonLogger json(String key, java.util.function.Supplier<com.google.gson.JsonElement> jsonElement)
JsonLoggerjson in interface JsonLoggerpublic JsonLogger exception(String key, Exception exception)
JsonLoggerexception in interface JsonLoggerpublic JsonLogger stack()
JsonLoggerstack in interface JsonLoggerpublic abstract void log()
JsonLoggerlog in interface JsonLoggerCopyright © 2016 Savoir Technologies, Inc.. All Rights Reserved.