Builder class for GelfMessage instances. More...
#include <GelfMessageBuilder.hpp>
Public Member Functions | |
GelfMessageBuilder & | operator() (const std::string &message) |
Sets the short_message field. More... | |
template<typename T > | |
GelfMessageBuilder & | operator() (const std::string &field, T value) |
Sets a field to the given value. More... | |
template<typename Decorator > | |
GelfMessageBuilder & | operator() (Decorator decorator) |
Applies a decorator to the message. More... | |
Builder class for GelfMessage instances.
Allows convenient construction for GelfMessages with additional Decorator support. The builder is implicitly convertible to a GelfMessage and can be directly passed to an Output.
Example usage:
Decorators are also supported. A decorator is a functional having the following syntax:
This allows to dynamically set common values via a globally defined decorator. Common use cases are e.g. adding the current timestamp, setting the "host" field.
Example useage:
|
inline |
Sets the short_message field.
Equivalent to gelf_message.SetMessage(message)
.
message | message |
*this
, for chaining
|
inline |
Sets a field to the given value.
Equivalent to gelf_message.SetField(field, value)
.
T | any supported field type, |
field | field name |
value | field value |
*this
, for chaining
|
inline |
Applies a decorator to the message.
Equivalent to decorator(gelf_message)
.
Decorator | decorator type |
decorator | decorator function |
*this
, for chaining