23#ifndef __STUMPLESS_ENTRY_H
24# define __STUMPLESS_ENTRY_H
29# include <stumpless/config.h>
37#define STUMPLESS_MAX_PROCID_LENGTH 128
40#define STUMPLESS_MAX_HOSTNAME_LENGTH 255
43# define STUMPLESS_MAX_APP_NAME_LENGTH 48
46# define STUMPLESS_MAX_MSGID_LENGTH 32
113# ifdef STUMPLESS_WINDOWS_EVENT_LOG_TARGETS_SUPPORTED
117# ifdef STUMPLESS_THREAD_SAFETY_SUPPORTED
233 const char *element_name,
234 const char *param_name,
235 const char *param_value );
691 size_t element_index,
692 size_t param_index );
731 const char *element_name,
732 const char *param_name );
770 size_t element_index,
771 size_t param_index );
816 const char *element_name,
817 const char *param_name );
1382 const char *
msgid );
1425 size_t element_index,
1463 size_t element_index,
1465 const char *value );
1512 const char *element_name,
1513 const char *param_name,
1514 const char *value );
#define STUMPLESS_PUBLIC_FUNCTION
Marks functions that are provided for use by the library.
定义 config.h:31
Types and functions for creating and modifying elements.
struct stumpless_entry * stumpless_set_entry_hostname(struct stumpless_entry *entry, const char *hostname)
Sets the hostname of a given entry.
struct stumpless_entry * stumpless_set_entry_message_str_w(struct stumpless_entry *entry, const wchar_t *message)
Sets the message of a given entry.
struct stumpless_entry * stumpless_set_entry_message(struct stumpless_entry *entry, const char *message,...)
Sets the message of a given entry.
struct stumpless_entry * stumpless_copy_entry(const struct stumpless_entry *entry)
Creates a copy of an entry.
struct stumpless_entry * vstumpless_new_entry(enum stumpless_facility facility, enum stumpless_severity severity, const char *app_name, const char *msgid, const char *message, va_list subs)
Creates a new entry with the given parameters.
enum stumpless_facility stumpless_get_entry_facility(const struct stumpless_entry *entry)
Returns the facility code of the given entry.
struct stumpless_entry * stumpless_set_entry_param_by_index(struct stumpless_entry *entry, size_t element_index, size_t param_index, struct stumpless_param *param)
Puts the param in the element at the given index of an entry.
void stumpless_unload_entry_and_contents(const struct stumpless_entry *entry)
Unloads an entry as well as all elements that it contains.
const char * stumpless_get_entry_msgid(const struct stumpless_entry *entry)
Returns the msgid of the given entry.
struct stumpless_param * stumpless_get_entry_param_by_name(const struct stumpless_entry *entry, const char *element_name, const char *param_name)
Gets the first param from the element with the given name in an entry.
struct stumpless_entry * stumpless_add_new_param_to_entry(struct stumpless_entry *entry, const char *element_name, const char *param_name, const char *param_value)
Creates a new param and adds it to the given element in the given entry.
void stumpless_unload_entry_only(const struct stumpless_entry *entry)
Unloads an entry, freeing any allocated memory.
void stumpless_destroy_entry_only(const struct stumpless_entry *entry)
Destroys an entry, freeing any allocated memory.
struct stumpless_entry * stumpless_set_entry_param_value_by_name(struct stumpless_entry *entry, const char *element_name, const char *param_name, const char *value)
Sets the value of the first param in the named element an entry.
struct stumpless_entry * stumpless_set_entry_msgid(struct stumpless_entry *entry, const char *msgid)
Sets the msgid for an entry.
struct stumpless_element * stumpless_get_element_by_index(const struct stumpless_entry *entry, size_t index)
Returns the element at the given index in this Entry.
size_t stumpless_get_element_index(const struct stumpless_entry *entry, const char *name)
Returns the index of the element with the given name in this entry, if it is found.
#define STUMPLESS_MAX_HOSTNAME_LENGTH
The maximum length of a hostname, as specified by RFC 5424.
定义 entry.h:40
int stumpless_get_entry_prival(const struct stumpless_entry *entry)
Returns the prival of the given entry, as defined in RFC 5424.
struct stumpless_entry * stumpless_set_entry_priority(struct stumpless_entry *entry, enum stumpless_facility facility, enum stumpless_severity severity)
Sets the facility and severity of an entry.
bool stumpless_entry_has_element(const struct stumpless_entry *entry, const char *name)
True if the given entry has an element with the given name, false otherwise.
struct stumpless_element * stumpless_get_element_by_name(const struct stumpless_entry *entry, const char *name)
Returns the element with the given name in this entry, if it is found.
struct stumpless_entry * stumpless_add_element(struct stumpless_entry *entry, struct stumpless_element *element)
Adds an element to an entry.
size_t stumpless_get_element_count(const struct stumpless_entry *entry)
Returns the number of elements in the given entry.
const char * stumpless_get_entry_message(const struct stumpless_entry *entry)
Returns the message of the given entry.
struct stumpless_entry * stumpless_set_entry_param_value_by_index(struct stumpless_entry *entry, 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 an entry.
struct stumpless_entry * stumpless_new_entry_str(enum stumpless_facility facility, enum stumpless_severity severity, const char *app_name, const char *msgid, const char *message)
Creates a new entry with the given characteristics.
void stumpless_destroy_entry(const struct stumpless_entry *entry)
An alias for stumpless_destroy_entry_and_contents.
struct stumpless_entry * stumpless_new_entry(enum stumpless_facility facility, enum stumpless_severity severity, const char *app_name, const char *msgid, const char *message,...)
Creates a new entry with the given characteristics.
struct stumpless_entry * stumpless_load_entry_str(struct stumpless_entry *entry, enum stumpless_facility facility, enum stumpless_severity severity, const char *app_name, const char *msgid, const char *message)
Creates a new entry with the given characteristics.
struct stumpless_entry * stumpless_set_entry_facility(struct stumpless_entry *entry, enum stumpless_facility facility)
Sets the facility of an entry.
struct stumpless_entry * stumpless_set_entry_severity(struct stumpless_entry *entry, enum stumpless_severity severity)
Sets the severity of an entry.
const char * stumpless_get_entry_app_name(const struct stumpless_entry *entry)
Returns the app name of the given entry.
struct stumpless_entry * stumpless_set_entry_app_name(struct stumpless_entry *entry, const char *app_name)
Sets the app name for an entry.
struct stumpless_entry * vstumpless_set_entry_message(struct stumpless_entry *entry, const char *message, va_list subs)
Sets the message of a given entry.
const char * stumpless_get_entry_param_value_by_name(const struct stumpless_entry *entry, const char *element_name, const char *param_name)
Gets the value of the first param from the element with the given name in an entry.
struct stumpless_entry * stumpless_load_entry(struct stumpless_entry *entry, enum stumpless_facility facility, enum stumpless_severity severity, const char *app_name, const char *msgid, const char *message,...)
Loads an entry struct with the given characteristics.
void stumpless_destroy_entry_and_contents(const struct stumpless_entry *entry)
Destroys an entry as well as all elements and params that it contains, freeing any allocated memory.
struct stumpless_entry * stumpless_set_entry_prival(struct stumpless_entry *entry, int prival)
Sets the prival of an entry, as defined in RFC 5424.
struct stumpless_param * stumpless_get_entry_param_by_index(const struct stumpless_entry *entry, size_t element_index, size_t param_index)
Gets the param from the element at the given index in an entry.
const char * stumpless_get_entry_hostname(const struct stumpless_entry *entry)
Returns the hostname of a given entry.
struct stumpless_entry * stumpless_set_element(struct stumpless_entry *entry, size_t index, struct stumpless_element *element)
Puts the element at the given index in the given entry.
#define STUMPLESS_MAX_PROCID_LENGTH
The maximum length of a procid, as specified by RFC 5424.
定义 entry.h:37
const char * stumpless_get_entry_procid(const struct stumpless_entry *entry)
Returns the procid of a given entry.
struct stumpless_entry * vstumpless_load_entry(struct stumpless_entry *entry, enum stumpless_facility facility, enum stumpless_severity severity, const char *app_name, const char *msgid, const char *message, va_list subs)
Creates a new entry with the given parameters.
#define STUMPLESS_MAX_APP_NAME_LENGTH
The maximum length of an app name, as specified by RFC 5424.
定义 entry.h:43
const char * stumpless_get_entry_param_value_by_index(const struct stumpless_entry *entry, size_t element_index, size_t param_index)
Gets the value of the param from the element at the given index in an entry.
struct stumpless_entry * stumpless_set_entry_procid(struct stumpless_entry *entry, const char *procid)
Sets the procid of a given entry.
struct stumpless_entry * stumpless_add_new_element(struct stumpless_entry *entry, const char *name)
Creates a new element with the given name and adds it to this entry.
struct stumpless_entry * stumpless_set_entry_message_str(struct stumpless_entry *entry, const char *message)
Sets the message of a given entry.
#define STUMPLESS_MAX_MSGID_LENGTH
The maximum length of a msgid, as specified by RFC 5424.
定义 entry.h:46
enum stumpless_severity stumpless_get_entry_severity(const struct stumpless_entry *entry)
Returns the severity code of the given entry.
Facility codes for classifying log entries.
stumpless_facility
All possible facility codes available to log entries.
定义 facility.h:347
The identification for targets within the library.
void * stumpless_id_t
定义 id.h:30
Types and functions for creating and modifying params.
Severity codes for classifying log entries.
stumpless_severity
All possible severity codes available to log entries.
定义 severity.h:189
An element of structured data.
定义 element.h:93
char name[32+1]
The name of the element.
定义 element.h:114
A log entry.
定义 entry.h:60
void * mutex
A pointer to a mutex which protects all entry fields.
定义 entry.h:122
struct stumpless_element ** elements
An array holding the elements of this entry.
定义 entry.h:110
char hostname[255+1]
The hostname of this entry, as a NULL-terminated string.
定义 entry.h:81
char msgid[32+1]
The message id of this entry, as a NULL-terminated string.
定义 entry.h:106
size_t message_length
The length of the message in bytes, without the NULL terminator.
定义 entry.h:104
int prival
The prival of this entry.
定义 entry.h:93
char * message
The message of this entry, as a NULL-terminated string.
定义 entry.h:102
char procid[128+1]
The procid of this entry, as a NULL-terminated string.
定义 entry.h:68
size_t hostname_length
The length of the hostname of this entry (in bytes), without a NULL terminator.
定义 entry.h:88
size_t procid_length
The length of the procid of this entry (in bytes), without a NULL terminator.
定义 entry.h:75
void * wel_data
A pointer to a wel_data structure.
定义 entry.h:115
size_t app_name_length
The length of the app name, without the NULL terminator.
定义 entry.h:97
size_t element_count
The number of elements in this entry.
定义 entry.h:112
size_t msgid_length
The length of the message id, without the NULL terminator.
定义 entry.h:108
char app_name[48+1]
The app name of this entry, as a NULL-terminated string.
定义 entry.h:95
stumpless_id_t id
A unique identifier of this entry.
定义 entry.h:62
A parameter within a structured data element.
定义 param.h:93