java.lang.Object
io.github.mmm.scanner.SimpleTextFormatMessageHandler
- All Implemented Interfaces:
TextFormatMessageHandler
Default implementation of
TextFormatMessageHandler.-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final Function<TextFormatMessageType,org.slf4j.event.Level> Maps eachTextFormatMessageTypeto its analogLevel.static final Function<TextFormatMessageType,org.slf4j.event.Level> -
Constructor Summary
ConstructorsConstructorDescriptionSimpleTextFormatMessageHandler(boolean throwOnError, org.slf4j.Logger logger, Function<TextFormatMessageType, org.slf4j.event.Level> logLevelMapper, boolean collectMessages) The constructor. -
Method Summary
-
Field Details
-
LOG_MAPPER_DEFAULT
Maps eachTextFormatMessageTypeto its analogLevel. -
LOG_MAPPER_INFO_AS_DEBUG
-
-
Constructor Details
-
SimpleTextFormatMessageHandler
public SimpleTextFormatMessageHandler(boolean throwOnError, org.slf4j.Logger logger, Function<TextFormatMessageType, org.slf4j.event.Level> logLevelMapper, boolean collectMessages) The constructor.- Parameters:
throwOnError- -trueto throw aRuntimeExceptionwhen anerrormessageishandled.logger- theLoggerused to logTextFormatMessages. May benullto omit logging.logLevelMapper- theFunctionto mapTextFormatMessageTypeto the according logLevel.collectMessages- the flag forisCollectMessages().
-
-
Method Details
-
handle
- Specified by:
handlein interfaceTextFormatMessageHandler
-
isCollectMessages
public boolean isCollectMessages()- Returns:
trueto collectmessages(default) ornullif noTextFormatMessageshould be collected andTextFormatProcessor.getMessages()will always return theempty list.
-
get
- Returns:
- the singleton instance.
-
ofThrowErrors
- Returns:
- a
SimpleTextFormatMessageHandlerthat throws an exception in case of aerrormessageand collects and logs other messages.
-
ofThrowErrorsNoLogging
- Returns:
- a
SimpleTextFormatMessageHandlerthat throws an exception in case of aerrormessageand collects other messages without any logging.
-