Package org.logevents.observers.slack
Class SlackLogEventsFormatter
- java.lang.Object
-
- org.logevents.observers.slack.SlackLogEventsFormatter
-
- All Implemented Interfaces:
JsonLogEventsBatchFormatter
- Direct Known Subclasses:
SlackAlertOnlyFormatter
public class SlackLogEventsFormatter extends Object implements JsonLogEventsBatchFormatter
Formats log event batches for suitable display on Slack. Writes the most important log event as messages text and creates attachments for MDCs, Markers, Level etc. Inherit to create your own slack experience.
-
-
Constructor Summary
Constructors Constructor Description SlackLogEventsFormatter()
SlackLogEventsFormatter(Map<String,String> properties, String prefix)
SlackLogEventsFormatter(Optional<String> username, Optional<String> channel)
SlackLogEventsFormatter(Configuration configuration)
-
Method Summary
-
-
-
Constructor Detail
-
SlackLogEventsFormatter
public SlackLogEventsFormatter()
-
SlackLogEventsFormatter
public SlackLogEventsFormatter(Optional<String> username, Optional<String> channel)
-
SlackLogEventsFormatter
public SlackLogEventsFormatter(Map<String,String> properties, String prefix)
-
SlackLogEventsFormatter
public SlackLogEventsFormatter(Configuration configuration)
-
-
Method Detail
-
createMessage
public Map<String,Object> createMessage(LogEventBatch batch)
- Specified by:
createMessage
in interfaceJsonLogEventsBatchFormatter
-
createText
protected String createText(LogEvent event)
Override this method to customize the contents of messages to Slack
-
createAttachments
protected List<Map<String,Object>> createAttachments(LogEventBatch batch)
Override this method to customize the contents of messages to Slack
-
createThrottledEventsAttachment
protected Map<String,Object> createThrottledEventsAttachment(LogEventBatch batch)
-
getColor
protected String getColor(org.slf4j.event.Level level)
-
createStackTraceAttachment
protected Map<String,Object> createStackTraceAttachment(LogEvent event)
-
slackMessageField
protected Map<String,Object> slackMessageField(String title, String value, boolean isShort)
-
setShowRepeatsIndividually
public void setShowRepeatsIndividually(boolean showRepeatsIndividually)
-
configureSourceCode
public void configureSourceCode(Configuration configuration)
-
setMdcFilter
public void setMdcFilter(MdcFilter mdcFilter)
-
-