stumpless 2.2.0
|
Severity codes for classifying log entries. More...
Go to the source code of this file.
Macros | |
#define | STUMPLESS_SEVERITY_MASK(SEVERITY) ( 1 << ( SEVERITY ) ) |
Creates a severity mask for the provided severity. | |
#define | STUMPLESS_SEVERITY_MASK_UPTO(SEVERITY) ( ( 1 << ( ( SEVERITY ) + 1 ) ) - 1 ) |
Creates a severity mask from EMERG up to the provided severity. | |
#define | STUMPLESS_SEVERITY_EMERG_VALUE 0 |
Severity code value for EMERG log entries. | |
#define | STUMPLESS_SEVERITY_ALERT_VALUE 1 |
Severity code value for ALERT log entries. | |
#define | STUMPLESS_SEVERITY_CRIT_VALUE 2 |
Severity code value for CRIT log entries. | |
#define | STUMPLESS_SEVERITY_ERR_VALUE 3 |
Severity code value for ERR log entries. | |
#define | STUMPLESS_SEVERITY_WARNING_VALUE 4 |
Severity code value for WARNING log entries. | |
#define | STUMPLESS_SEVERITY_NOTICE_VALUE 5 |
Severity code value for NOTICE log entries. | |
#define | STUMPLESS_SEVERITY_INFO_VALUE 6 |
Severity code value for INFO log entries. | |
#define | STUMPLESS_SEVERITY_DEBUG_VALUE 7 |
Severity code value for DEBUG log entries. | |
#define | STUMPLESS_SEVERITY_TRACE_VALUE STUMPLESS_SEVERITY_DEBUG_VALUE |
Equivalent to the DEBUG severity code value. | |
#define | STUMPLESS_FOREACH_SEVERITY(ACTION) |
A macro function that runs the provided action once for each severity, providing the symbol and value. | |
#define | STUMPLESS_SEVERITY_TRACE STUMPLESS_SEVERITY_DEBUG |
Equivalent to the DEBUG severity. | |
Enumerations | |
enum | stumpless_severity { STUMPLESS_GENERATE_ENUM =( STUMPLESS_SEVERITY_EMERG, 0 ) STUMPLESS_GENERATE_ENUM( STUMPLESS_SEVERITY_ALERT, 1 ) STUMPLESS_GENERATE_ENUM( STUMPLESS_SEVERITY_CRIT, 2 ) STUMPLESS_GENERATE_ENUM( STUMPLESS_SEVERITY_ERR, 3 ) STUMPLESS_GENERATE_ENUM( STUMPLESS_SEVERITY_WARNING, 4 ) STUMPLESS_GENERATE_ENUM( STUMPLESS_SEVERITY_NOTICE, 5 ) STUMPLESS_GENERATE_ENUM( STUMPLESS_SEVERITY_INFO, 6 ) STUMPLESS_GENERATE_ENUM( STUMPLESS_SEVERITY_DEBUG, 7 ) } |
All possible severity codes available to log entries. More... | |
Functions | |
STUMPLESS_PUBLIC_FUNCTION const char * | stumpless_get_severity_string (enum stumpless_severity severity) |
Gets the string representation of the given severity. | |
STUMPLESS_PUBLIC_FUNCTION enum stumpless_severity | stumpless_get_severity_enum (const char *severity_string) |
Gets the enum value corresponding to the given severity string. | |
STUMPLESS_PUBLIC_FUNCTION enum stumpless_severity | stumpless_get_severity_enum_from_buffer (const char *buffer, size_t length) |
Gets the enum value corresponding to the given severity string in a buffer. | |
Severity codes for classifying log entries.
See RFC 5424 section 6.2.1 for details on these values. Severities are defined to be compatible with the syslog.h header if it is found on the system. Otherwise, they are defined as closely as possible to the RFC 5424 specification.
#define STUMPLESS_FOREACH_SEVERITY | ( | ACTION | ) |
A macro function that runs the provided action once for each severity, providing the symbol and value.
The action must take two arguments, the first being the symbol name of the severity, and the second the numeric value of the severity.
#define STUMPLESS_SEVERITY_ALERT_VALUE 1 |
Severity code value for ALERT log entries.
#define STUMPLESS_SEVERITY_CRIT_VALUE 2 |
Severity code value for CRIT log entries.
#define STUMPLESS_SEVERITY_DEBUG_VALUE 7 |
Severity code value for DEBUG log entries.
#define STUMPLESS_SEVERITY_EMERG_VALUE 0 |
Severity code value for EMERG log entries.
#define STUMPLESS_SEVERITY_ERR_VALUE 3 |
Severity code value for ERR log entries.
#define STUMPLESS_SEVERITY_INFO_VALUE 6 |
Severity code value for INFO log entries.
#define STUMPLESS_SEVERITY_MASK | ( | SEVERITY | ) | ( 1 << ( SEVERITY ) ) |
Creates a severity mask for the provided severity.
#define STUMPLESS_SEVERITY_MASK_UPTO | ( | SEVERITY | ) | ( ( 1 << ( ( SEVERITY ) + 1 ) ) - 1 ) |
Creates a severity mask from EMERG up to the provided severity.
#define STUMPLESS_SEVERITY_NOTICE_VALUE 5 |
Severity code value for NOTICE log entries.
#define STUMPLESS_SEVERITY_TRACE STUMPLESS_SEVERITY_DEBUG |
Equivalent to the DEBUG severity.
Trace level messages include extra information, but do not have a distinct severity value in log entries.
#define STUMPLESS_SEVERITY_TRACE_VALUE STUMPLESS_SEVERITY_DEBUG_VALUE |
Equivalent to the DEBUG severity code value.
Trace level messages include extra information, but do not have a distinct severity value in log entries.
#define STUMPLESS_SEVERITY_WARNING_VALUE 4 |
Severity code value for WARNING log entries.
enum stumpless_severity |
All possible severity codes available to log entries.
In versions prior to 2.0.0, these values were simply #define symbols. They have been changed to an enum to clearly convey proper usage.
See STUMPLESS_FOREACH_SEVERITY() and STUMPLESS_GENERATE_ENUM() for how the enumeration is actually defined.
Enumerator | |
---|---|
STUMPLESS_GENERATE_ENUM | Emergency: system is unusable. |
STUMPLESS_PUBLIC_FUNCTION enum stumpless_severity stumpless_get_severity_enum | ( | const char * | severity_string | ) |
Gets the enum value corresponding to the given severity string.
Thread Safety: MT-Safe This function is thread safe.
Async Signal Safety: AS-Safe This function is safe to call from signal handlers.
Async Cancel Safety: AC-Safe This function is safe to call from threads that may be asynchronously cancelled.
severity_string | The severity name to get the enum from. |
STUMPLESS_PUBLIC_FUNCTION enum stumpless_severity stumpless_get_severity_enum_from_buffer | ( | const char * | buffer, |
size_t | length ) |
Gets the enum value corresponding to the given severity string in a buffer.
Thread Safety: MT-Safe This function is thread safe.
Async Signal Safety: AS-Safe This function is safe to call from signal handlers.
Async Cancel Safety: AC-Safe This function is safe to call from threads that may be asynchronously cancelled.
buffer | The buffer containing the severity name to get the enum from. |
length | The length of the buffer. |
STUMPLESS_PUBLIC_FUNCTION const char * stumpless_get_severity_string | ( | enum stumpless_severity | severity | ) |
Gets the string representation of the given severity.
This is a string literal that should not be modified or freed by the caller.
Thread Safety: MT-Safe This function is thread safe.
Async Signal Safety: AS-Safe This function is safe to call from signal handlers.
Async Cancel Safety: AC-Safe This function is safe to call from threads that may be asynchronously cancelled.
severity | The severity to get the string from. |