public class GelfMessageBuilder extends Object
GelfMessageBuilder can be used to build one or more valid GelfMessages.
Since the message properties are stored in the GelfMessageBuilder instance, it
can be used as a template for building GelfMessages.
This class is not thread-safe.
GelfMessage| Constructor and Description |
|---|
GelfMessageBuilder(String message)
Construct a
GelfMessageBuilder instance with the given message. |
GelfMessageBuilder(String message,
String host)
Construct a
GelfMessageBuilder instance with the given message and @{code host} field. |
GelfMessageBuilder(String message,
String host,
GelfMessageVersion version)
Construct a
GelfMessageBuilder instance with the given message and @{code host} field. |
| Modifier and Type | Method and Description |
|---|---|
GelfMessageBuilder |
additionalField(String key,
Object value)
Add an additional field (key-/value-pair) to the
GelfMessage. |
GelfMessageBuilder |
additionalFields(Map<String,Object> additionalFields)
Add the contents of a
Map as additional fields (key-/value-pairs) to the GelfMessage. |
GelfMessage |
build()
Build a new
GelfMessage with all information from the GelfMessageBuilder. |
GelfMessageBuilder |
fullMessage(String fullMessage)
Set the full message (e.
|
GelfMessageBuilder |
level(GelfMessageLevel level)
Set the level (priority) of the
GelfMessage. |
GelfMessageBuilder |
message(String message)
Set the (short) message of the
GelfMessage. |
GelfMessageBuilder |
timestamp(double timestamp)
Set the timestamp (seconds since UNIX epoch) of the
GelfMessage. |
GelfMessageBuilder |
timestamp(long millis)
Set the timestamp (milliseconds since UNIX epoch) of the
GelfMessage. |
public GelfMessageBuilder(String message)
GelfMessageBuilder instance with the given message.message - The message of the GelfMessagepublic GelfMessageBuilder(String message, String host)
GelfMessageBuilder instance with the given message and @{code host} field.message - The message of the GelfMessagehost - The contents of the host field of the GelfMessagepublic GelfMessageBuilder(String message, String host, GelfMessageVersion version)
GelfMessageBuilder instance with the given message and @{code host} field.message - The message of the GelfMessagehost - The contents of the host field of the GelfMessageversion - The version of the GELF specification to usepublic GelfMessageBuilder message(String message)
GelfMessage.message - the (short) message of the GelfMessagethis instancepublic GelfMessageBuilder fullMessage(String fullMessage)
GelfMessage.fullMessage - the full message of the GelfMessagethis instancepublic GelfMessageBuilder timestamp(double timestamp)
GelfMessage.timestamp - the timestamp of the GelfMessage (seconds since UNIX epoch)this instancepublic GelfMessageBuilder timestamp(long millis)
GelfMessage.millis - the timestamp of the GelfMessage (milliseconds since UNIX epoch)this instancepublic GelfMessageBuilder level(GelfMessageLevel level)
GelfMessage.
Can be set to null to remove the (optional) level from the GelfMessage.level - the GelfMessageLevel of the GelfMessage.this instancepublic GelfMessageBuilder additionalField(String key, Object value)
GelfMessage.key - the key of the additional fieldvalue - the value of the additional fieldthis instancepublic GelfMessageBuilder additionalFields(Map<String,Object> additionalFields)
Map as additional fields (key-/value-pairs) to the GelfMessage.additionalFields - the Map which will be added as additional fieldsthis instancepublic GelfMessage build()
GelfMessage with all information from the GelfMessageBuilder.GelfMessage instance.IllegalArgumentException - if any mandatory information is missing.Copyright © 2016 TORCH. All rights reserved.