Demonstrates how to work with runtime filters on logging targets.
Demonstrates how to work with runtime filters on logging targets.
#include <stdbool.h>
#include <stdlib.h>
bool
}
int
main( int argc, char **argv ) {
int new_mask;
STUMPLESS_SEVERITY_ERR,
"filter-example",
"annoying-msg",
"hey! listen!" );
return EXIT_SUCCESS;
}
#define stump_a(...)
Logs a message to the current target with alert severity.
Definition alert.h:97
#define stump_c(...)
Logs a message to the current target with crit severity.
Definition crit.h:97
#define stump_d(...)
Logs a message to the current target with debug severity.
Definition debug.h:97
#define stump_em(...)
Logs a message to the current target with emerg severity.
Definition emerg.h:97
STUMPLESS_PUBLIC_FUNCTION 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.
STUMPLESS_PUBLIC_FUNCTION 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.
STUMPLESS_PUBLIC_FUNCTION 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.
STUMPLESS_PUBLIC_FUNCTION 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.
#define stump_er(...)
Logs a message to the current target with err severity.
Definition err.h:97
STUMPLESS_PUBLIC_FUNCTION bool stumpless_mask_filter(const struct stumpless_target *target, const struct stumpless_entry *entry)
Compares the severity of the entry to the current mask of the target, and only passes the entry if th...
#define stump_i(...)
Logs a message to the current target with info severity.
Definition info.h:97
STUMPLESS_PUBLIC_FUNCTION int stumplog_set_mask(int mask)
Sets the log mask of the current target.
STUMPLESS_PUBLIC_FUNCTION void stumpless_free_all(void)
Closes the default target if it has been opened, frees all memory allocated internally,...
#define stump_n(...)
Logs a message to the current target with notice severity.
Definition notice.h:97
#define STUMPLESS_SEVERITY_MASK(SEVERITY)
Creates a severity mask for the provided severity.
Definition severity.h:41
#define STUMPLESS_SEVERITY_MASK_UPTO(SEVERITY)
Creates a severity mask from EMERG up to the provided severity.
Definition severity.h:48
STUMPLESS_PUBLIC_FUNCTION void stumpless_close_stream_target(const struct stumpless_target *target)
Closes a stream target.
STUMPLESS_PUBLIC_FUNCTION struct stumpless_target * stumpless_open_stdout_target(const char *name)
Opens a stream target for the stdout stream.
A log entry.
Definition entry.h:60
A target that log entries can be sent to.
Definition target.h:140
The main header file for the stumpless logging library.
STUMPLESS_PUBLIC_FUNCTION struct stumpless_target * stumpless_set_target_filter(struct stumpless_target *target, stumpless_filter_func_t filter)
Sets the filter used to determine whether entries should be logged by a given target.
STUMPLESS_PUBLIC_FUNCTION int stumpless_add_entry(struct stumpless_target *target, const struct stumpless_entry *entry)
Adds an entry into a given target.
#define stump_t(...)
Logs a message to the current target with debug severity, along with the file, line,...
Definition trace.h:106
#define stump_w(...)
Logs a message to the current target with warning severity.
Definition warning.h:97