Simple wrapper around the parsing and generating os syslog messages.
More...
#include "util/syslogmessage.h"
|
| | SyslogMessage () |
| | Standard constructor.
|
|
| SyslogMessage (const SyslogMessage &)=default |
| | Default copy constructor.
|
| | SyslogMessage (const util::log::LogMessage &log, bool show_location) |
| | Constructor that converts a log message,.
|
|
virtual | ~SyslogMessage ()=default |
| | Default destructor.
|
| void | Index (int64_t index) |
| | Index used to identify the message.
|
|
int64_t | Index () const |
| | Unique index.
|
| void | Severity (SyslogSeverity severity) |
| SyslogSeverity | Severity () const |
| void | Facility (SyslogFacility facility) |
| SyslogFacility | Facility () const |
| uint8_t | Version () const |
| void | Timestamp (uint64_t ns1970) |
| uint64_t | Timestamp () const |
|
void | Hostname (const std::string &name) |
| | Sets the host name.
|
| const std::string & | Hostname () const |
|
void | ApplicationName (const std::string &name) |
| | Sets the application name.
|
| const std::string & | ApplicationName () const |
|
void | ProcessId (const std::string &pid) |
| | Sets the PID.
|
| const std::string & | ProcessId () const |
|
void | MessageId (const std::string &msg_id) |
| | Sets the message ID.
|
| const std::string & | MessageId () const |
| void | Message (const std::string &msg) |
| | Sets the message test.
|
| const std::string & | Message () const |
| | Returns the message text.
|
| void | AddData (const StructuredData &data) |
| const std::vector< StructuredData > & | DataList () const |
|
std::string | GenerateMessage () const |
| | Generates a syslog message.
|
|
bool | ParseMessage (const std::string &msg) |
| | Parses a syslog message.
|
|
void | AddStructuredData (const std::string &identity) |
| | Adds a structured data item without any parameters.
|
| void | AppendParameter (const std::string &name, const std::string &value) |
| void | Version (uint8_t version) |
| void | IsoTime (const std::string &iso_time) |
| | Sets the timestamp by converting a ISO time string.
|
The class is a simple interface against a syslog message according to the RFC5424 standard.
◆ SyslogMessage() [1/2]
| util::syslog::SyslogMessage::SyslogMessage |
( |
| ) |
|
Standard constructor that enables creating and parsing of system log messages.
◆ SyslogMessage() [2/2]
Constructor used when converting a log message into a syslog message, The location flag should be set if the source location should be included.
- Parameters
-
| log | Log message |
| show_location | Set tor true if source location should be included. |
◆ AddData()
| void util::syslog::SyslogMessage::AddData |
( |
const StructuredData & | data | ) |
|
|
inline |
< Adds structured data to the message.
◆ AppendParameter()
| void util::syslog::SyslogMessage::AppendParameter |
( |
const std::string & | name, |
|
|
const std::string & | value ) |
Append parameter item to the last data item.
◆ ApplicationName()
| const std::string & util::syslog::SyslogMessage::ApplicationName |
( |
| ) |
const |
|
inlinenodiscard |
< Returns the application name
◆ DataList()
| const std::vector< StructuredData > & util::syslog::SyslogMessage::DataList |
( |
| ) |
const |
|
inlinenodiscard |
< Returns a list of structured data items.
◆ Facility() [1/2]
< Returns the facility code.
◆ Facility() [2/2]
◆ Hostname()
| const std::string & util::syslog::SyslogMessage::Hostname |
( |
| ) |
const |
|
inlinenodiscard |
◆ Index()
| void util::syslog::SyslogMessage::Index |
( |
int64_t | index | ) |
|
|
inline |
Index that is used as an unique identifier of the message. The index is not received or transmitted.
- Parameters
-
| index | 64-bit unique index. Optional use. |
◆ IsoTime()
| void util::syslog::SyslogMessage::IsoTime |
( |
const std::string & | iso_time | ) |
|
Function that is used when parsing syslog messages and converts the incoming ISO time string into a timestamp.
- Parameters
-
| iso_time | ISO time formatted string. |
◆ Message() [1/2]
| const std::string & util::syslog::SyslogMessage::Message |
( |
| ) |
const |
|
inlinenodiscard |
Returns the message text. Note that the string is UTF8 decoded.
- Returns
- Messag text.
◆ Message() [2/2]
| void util::syslog::SyslogMessage::Message |
( |
const std::string & | msg | ) |
|
Sets the message text. Note that it assume that the string is UTF8 decoded.
- Parameters
-
◆ MessageId()
| const std::string & util::syslog::SyslogMessage::MessageId |
( |
| ) |
const |
|
inlinenodiscard |
◆ ProcessId()
| const std::string & util::syslog::SyslogMessage::ProcessId |
( |
| ) |
const |
|
inlinenodiscard |
◆ Severity() [1/2]
< Returns the severity level
◆ Severity() [2/2]
< Sets the severity level
◆ Timestamp() [1/2]
| uint64_t util::syslog::SyslogMessage::Timestamp |
( |
| ) |
const |
|
inlinenodiscard |
< Returns the timestamp (ns since 1970).
◆ Timestamp() [2/2]
| void util::syslog::SyslogMessage::Timestamp |
( |
uint64_t | ns1970 | ) |
|
|
inline |
< Sets the timestamp (ns since 1970).
◆ Version() [1/2]
| uint8_t util::syslog::SyslogMessage::Version |
( |
| ) |
const |
|
inlinenodiscard |
◆ Version() [2/2]
| void util::syslog::SyslogMessage::Version |
( |
uint8_t | version | ) |
|
|
inline |
< Sets the version number. Default is 1.
The documentation for this class was generated from the following file: