public class GelfMessageBuilder extends Object
Modifier and Type | Field and Description |
---|---|
protected Map<String,String> |
additionalFields |
protected Map<String,String> |
additionalFieldTypes |
protected Map<Pattern,String> |
dynamicMdcFieldTypes |
protected String |
facility |
protected String |
fullMessage |
protected String |
host |
protected long |
javaTimestamp |
protected String |
level |
protected int |
maximumMessageSize |
protected String |
shortMessage |
protected String |
version |
Modifier | Constructor and Description |
---|---|
protected |
GelfMessageBuilder() |
Modifier and Type | Method and Description |
---|---|
GelfMessage |
build()
Build a new Gelf message based on the builder settings.
|
static GelfMessageBuilder |
newInstance()
Creates a new instance of the GelfMessageBuilder.
|
GelfMessageBuilder |
withAdditionalFieldTypes(Map<String,String> additionalFieldTypes)
Set additional field types
|
GelfMessageBuilder |
withDynamicMdcFieldTypes(Map<Pattern,String> dynamicMdcFieldTypes)
Set dynamic mdc field types
|
GelfMessageBuilder |
withFacility(String facility)
Set the facility.
|
GelfMessageBuilder |
withField(String key,
String value)
Add an additional field.
|
GelfMessageBuilder |
withFields(Map<String,String> additionalFields)
Add additional fields.
|
GelfMessageBuilder |
withFullMessage(String fullMessage)
Set the full_message.
|
GelfMessageBuilder |
withHost(String host)
Set the host.
|
GelfMessageBuilder |
withJavaTimestamp(long javaTimestamp)
Set the java timestamp (millis).
|
GelfMessageBuilder |
withLevel(String level)
Set the level (severity).
|
GelfMessageBuilder |
withMaximumMessageSize(int maximumMessageSize)
Set the max message size.
|
GelfMessageBuilder |
withShortMessage(String shortMessage)
Set the short_message.
|
GelfMessageBuilder |
withVersion(String version)
Set the version.
|
protected String version
protected String host
protected String shortMessage
protected String fullMessage
protected long javaTimestamp
protected String level
protected String facility
protected int maximumMessageSize
public static GelfMessageBuilder newInstance()
public GelfMessageBuilder withVersion(String version)
version
- the versionpublic GelfMessageBuilder withHost(String host)
host
- the hostpublic GelfMessageBuilder withShortMessage(String shortMessage)
shortMessage
- the short_messagepublic GelfMessageBuilder withFullMessage(String fullMessage)
fullMessage
- the fullMessagepublic GelfMessageBuilder withLevel(String level)
level
- the levelpublic GelfMessageBuilder withFacility(String facility)
facility
- the facilitypublic GelfMessageBuilder withMaximumMessageSize(int maximumMessageSize)
maximumMessageSize
- the maximumMessageSizepublic GelfMessageBuilder withJavaTimestamp(long javaTimestamp)
javaTimestamp
- the javaTimestamppublic GelfMessageBuilder withFields(Map<String,String> additionalFields)
additionalFields
- the additionalFieldspublic GelfMessageBuilder withField(String key, String value)
key
- the keyvalue
- the valuepublic GelfMessageBuilder withAdditionalFieldTypes(Map<String,String> additionalFieldTypes)
additionalFieldTypes
- the type mappublic GelfMessageBuilder withDynamicMdcFieldTypes(Map<Pattern,String> dynamicMdcFieldTypes)
dynamicMdcFieldTypes
- the type mappublic GelfMessage build()
Copyright © 2013–2023. All rights reserved.