Package org.apache.bookkeeper.slogger
Class AbstractSlogger
- java.lang.Object
-
- org.apache.bookkeeper.slogger.AbstractSlogger
-
- All Implemented Interfaces:
java.lang.Iterable<java.lang.Object>
,Slogger
- Direct Known Subclasses:
ConsoleSlogger
,Slf4jSlogger
public abstract class AbstractSlogger extends java.lang.Object implements Slogger, java.lang.Iterable<java.lang.Object>
Abstract implementation of slogger. Keeps track of key value pairs.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description (package private) class
AbstractSlogger.CtxIterator
static class
AbstractSlogger.Level
Levels at which slogger can slog.
-
Constructor Summary
Constructors Modifier Constructor Description protected
AbstractSlogger(java.lang.Iterable<java.lang.Object> parentCtx)
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description protected void
clearCurrentCtx()
Slogger
ctx()
Slogger
ctx(java.lang.Class<?> clazz)
protected abstract void
doLog(AbstractSlogger.Level level, java.lang.Enum<?> event, java.lang.String message, java.lang.Throwable throwable, java.util.List<java.lang.Object> keyValues)
void
error(java.lang.Enum<?> event)
void
error(java.lang.Enum<?> event, java.lang.Throwable cause)
void
error(java.lang.String message)
void
error(java.lang.String message, java.lang.Throwable cause)
protected void
flattenKeyValues(java.util.function.BiConsumer<java.lang.String,java.lang.String> consumer)
static void
flattenKeyValues(java.util.Iterator<java.lang.Object> iter, java.util.function.BiConsumer<java.lang.String,java.lang.String> consumer)
void
info(java.lang.Enum<?> event)
void
info(java.lang.Enum<?> event, java.lang.Throwable cause)
void
info(java.lang.String message)
void
info(java.lang.String message, java.lang.Throwable cause)
java.util.Iterator<java.lang.Object>
iterator()
Slogger
kv(java.lang.Object key, java.lang.Object value)
protected abstract Slogger
newSlogger(java.util.Optional<java.lang.Class<?>> clazz, java.lang.Iterable<java.lang.Object> parent)
void
warn(java.lang.Enum<?> event)
void
warn(java.lang.Enum<?> event, java.lang.Throwable cause)
void
warn(java.lang.String message)
void
warn(java.lang.String message, java.lang.Throwable cause)
-
-
-
Method Detail
-
newSlogger
protected abstract Slogger newSlogger(java.util.Optional<java.lang.Class<?>> clazz, java.lang.Iterable<java.lang.Object> parent)
-
doLog
protected abstract void doLog(AbstractSlogger.Level level, java.lang.Enum<?> event, java.lang.String message, java.lang.Throwable throwable, java.util.List<java.lang.Object> keyValues)
-
info
public void info(java.lang.String message, java.lang.Throwable cause)
-
info
public void info(java.lang.Enum<?> event, java.lang.Throwable cause)
-
warn
public void warn(java.lang.String message, java.lang.Throwable cause)
-
warn
public void warn(java.lang.Enum<?> event, java.lang.Throwable cause)
-
error
public void error(java.lang.String message, java.lang.Throwable cause)
-
error
public void error(java.lang.Enum<?> event, java.lang.Throwable cause)
-
iterator
public java.util.Iterator<java.lang.Object> iterator()
- Specified by:
iterator
in interfacejava.lang.Iterable<java.lang.Object>
-
clearCurrentCtx
protected void clearCurrentCtx()
-
flattenKeyValues
protected void flattenKeyValues(java.util.function.BiConsumer<java.lang.String,java.lang.String> consumer)
-
flattenKeyValues
public static void flattenKeyValues(java.util.Iterator<java.lang.Object> iter, java.util.function.BiConsumer<java.lang.String,java.lang.String> consumer)
-
-