Package nl.vpro.logging.simple
Class AbstractStringBuilderSimpleLogger
- java.lang.Object
-
- nl.vpro.logging.simple.AbstractStringBuilderSimpleLogger
-
- All Implemented Interfaces:
BiConsumer<Level,CharSequence>
,SimpleLogger
- Direct Known Subclasses:
OutputStreamSimpleLogger
,StringBuilderSimpleLogger
public abstract class AbstractStringBuilderSimpleLogger extends Object implements SimpleLogger
Simply logs everything to a StringBuilder. It also works as a tail (to avoid excessive memory usage if lots is logged) If more thangetMaxLength()
lines are logged, the string will be prefixed byTRUNK
and the earliest lines are removed.- Since:
- 1.79
- Author:
- Michiel Meeuwissen
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface nl.vpro.logging.simple.SimpleLogger
SimpleLogger.RemoveFromThreadLocal
-
-
Field Summary
Fields Modifier and Type Field Description protected long
count
-
Fields inherited from interface nl.vpro.logging.simple.SimpleLogger
THREAD_LOCAL
-
-
Constructor Summary
Constructors Modifier Constructor Description protected
AbstractStringBuilderSimpleLogger()
protected
AbstractStringBuilderSimpleLogger(Level level, Long maxLength, Function<Level,String> prefix)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
accept(Level level, CharSequence message, Throwable t)
long
getCount()
long
getMaxLength()
boolean
isTruncated()
protected boolean
needsNewLine()
String
toString()
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface java.util.function.BiConsumer
andThen
-
-
-
-
Method Detail
-
accept
public void accept(Level level, CharSequence message, Throwable t)
- Specified by:
accept
in interfaceSimpleLogger
-
needsNewLine
protected boolean needsNewLine()
-
getMaxLength
public long getMaxLength()
-
getCount
public long getCount()
-
isTruncated
public boolean isTruncated()
-
-