stumpless 2.2.0
Loading...
Searching...
No Matches
Entry.hpp
Go to the documentation of this file.
1#ifndef __ENTRY_HPP
2#define __ENTRY_HPP
3
4#include <stumpless/entry.h>
5#include <stumpless/Facility.hpp>
6#include <stumpless/Severity.hpp>
7#include <stumpless/Entry.hpp>
8#include <stumpless/Element.hpp>
9#include <stddef.h>
10#include <stumpless/Param.hpp>
11
12namespace stumpless {
13
19 class Entry {
20 public:
21
22 struct stumpless_entry *equivalent;
23
46 Entry( Facility facility, Severity severity, const char *app_name, const char *msgid, const char *message, ... );
56 Entry( struct stumpless_entry *entry );
64 Entry( const Entry & entry );
68 ~Entry( void );
76 Entry& AddElement( Element& element );
88 Entry& AddElement( Element *element );
100 Entry& AddElement( const char *name );
117 Entry& AddParam( const char *element_name, const char *param_name, const char *param_value );
125 const char *GetAppName( void );
135 Element GetElement( size_t index );
145 Element GetElement( const char *name );
151 size_t GetElementCount( void );
161 size_t GetElementIndex( const char *name );
179 const char *GetMessage( void );
187 const char *GetMsgid( void );
199 Param GetParam( size_t element_index, size_t param_index );
218 Param GetParam( const char *element_name, const char *param_name );
234 const char *GetParamValue( size_t element_index, size_t param_index );
255 const char *GetParamValue( const char *element_name, const char *param_name );
263 int GetPrival( void );
281 bool HasElement( const char *name );
293 Entry& SetAppName( const char *app_name );
312 Entry& SetElement( size_t index, Element & element );
335 Entry& SetMsgid( const char *msgid );
350 Entry& SetMessage( const char *message, ... );
367 Entry& SetParam( size_t element_index, size_t param_index, Param & param );
382 Entry& SetParamValue( size_t element_index, size_t param_index, const char *value );
409 Entry& SetParamValue( const char *element_name, const char *param_name, const char *value );
421 Entry& SetPriority( Facility facility, Severity severity );
431 Entry& SetPrival( int prival );
442 };
443
444}
445
446#endif
An element of structured data.
Definition Element.hpp:15
A log entry.
Definition Entry.hpp:19
Entry(const Entry &entry)
Creates an Entry as a copy of another Entry.
const char * GetMsgid(void)
Gets the msgid of this Entry.
Entry & SetFacility(Facility facility)
Sets the Facility of this Entry.
Entry & AddElement(Element *element)
Adds an Element to this Entry.
const char * GetParamValue(const char *element_name, const char *param_name)
Gets the value of the first Param from the Element with the given name from this Entry.
size_t GetElementIndex(const char *name)
Gets the index of the Element with the given name from this Entry.
Entry & SetMsgid(const char *msgid)
Sets the msgid for this Entry.
Entry & SetElement(size_t index, Element &element)
Puts the element at the given index in this Entry.
Entry & SetMessage(const char *message,...)
Sets the message of an Entry.
Param GetParam(size_t element_index, size_t param_index)
Gets the Param from the Element at the given index from this Entry.
size_t GetElementCount(void)
Returns the number of elements in this Entry.
Entry(Facility facility, Severity severity, const char *app_name, const char *msgid, const char *message,...)
Creates an Entry with the given properties.
const char * GetMessage(void)
Gets the message from this Entry.
Severity GetSeverity(void)
Gets the Severity of this Entry.
struct stumpless_entry * equivalent
Definition Entry.hpp:22
Entry & SetPrival(int prival)
Sets the prival of this Entry, as defined in RFC 5424.
Element GetElement(size_t index)
Gets the Element at the given index in this Entry.
Entry & SetPriority(Facility facility, Severity severity)
Sets the Facility and Severity of this Entry.
Entry & SetParamValue(size_t element_index, size_t param_index, const char *value)
Sets the value of the Param in the Element at the given index of this Entry.
bool HasElement(const char *name)
True if this Entry has an Element with the given name, false otherwise.
~Entry(void)
Destroys the Entry and frees any memory allocated for it.
Entry & SetParamValue(const char *element_name, const char *param_name, const char *value)
Sets the value of the first Param with the given name in the Element with the given name in this Entr...
Entry & SetSeverity(Severity severity)
Sets the Severity of this Entry.
const char * GetParamValue(size_t element_index, size_t param_index)
Gets the value of the Param from the Element at the given index from this Entry.
Entry & SetAppName(const char *app_name)
Sets the app name for an entry.
int GetPrival(void)
Gets the prival of this Entry, as defined in RFC 5424.
Entry & AddParam(const char *element_name, const char *param_name, const char *param_value)
Creates a new Param and adds it to the specified Element in this Entry.
Entry(struct stumpless_entry *entry)
Creates an Entry from a stumpless_entry struct.
Element GetElement(const char *name)
Gets the Element with the given name from this Entry.
Entry & AddElement(Element &element)
Adds an element to an entry.
Entry & SetParam(size_t element_index, size_t param_index, Param &param)
Puts the Param in the Element at the given index of this Entry.
Param GetParam(const char *element_name, const char *param_name)
Gets the first Param from the Element with the given name from this Entry.
Entry & AddElement(const char *name)
Creates a new Element and adds it to this Entry.
Facility GetFacility(void)
Gets the Facility of this Entry.
const char * GetAppName(void)
Gets the app name from this Entry.
A parameter within a structured data element.
Definition Param.hpp:12
Definition AddressFailure.hpp:7
Facility
Facilities (as defined in RFC 5424) describe the general classification of an event.
Definition Facility.hpp:17
Severity
Severities (as defined in RFC 5424) describe the level of importance of a given log entry.
Definition Severity.hpp:15