Class CachedLogger
java.lang.Object
com.reposilite.journalist.backend.DefaultLogger
com.reposilite.journalist.backend.CachedLogger
- All Implemented Interfaces:
Journalist,Logger
Stores all messages in memory as a queue with limit and does not print any message directly.
-
Field Summary
Fields inherited from class com.reposilite.journalist.backend.DefaultLogger
threshold -
Constructor Summary
ConstructorsConstructorDescriptionCachedLogger(int capacity) UsesChannel.INFOas a default threshold.CachedLogger(Channel threshold, int capacity) -
Method Summary
Modifier and TypeMethodDescriptionbooleanCheck if one of the stored messages contain the given text.find(BiPredicate<Channel, String> filter) Find entry with message and channel related to it.Get all stored messages.protected voidinternalLog(Channel channel, String message) Internal method used byDefaultLoggerto send processed message to the final implementation.Methods inherited from class com.reposilite.journalist.backend.DefaultLogger
exception, getLogger, log, setThreshold, toPrintStream
-
Constructor Details
-
CachedLogger
-
CachedLogger
public CachedLogger(int capacity) UsesChannel.INFOas a default threshold.- Parameters:
capacity- the capacity of messages cache
-
-
Method Details
-
internalLog
Description copied from class:DefaultLoggerInternal method used byDefaultLoggerto send processed message to the final implementation.- Specified by:
internalLogin classDefaultLogger- Parameters:
channel- the channel to log tomessage- the message to log
-
contains
Check if one of the stored messages contain the given text.- Parameters:
message- the text to search for- Returns:
- true if any stored message contains the given value, otherwise false
-
find
Find entry with message and channel related to it.- Parameters:
filter- the predicate for the channel or the message of the entry- Returns:
- the entry of the given predicate
-
getMessages
Get all stored messages.- Returns:
- the list of stored messages
-