26#ifndef __STUMPLESS_SEVERITY_H
27# define __STUMPLESS_SEVERITY_H
29# include <stumpless/config.h>
33# ifdef STUMPLESS_SYSLOG_H_COMPATIBLE
38# ifdef STUMPLESS_SYSLOG_H_COMPATIBLE
39# define STUMPLESS_SEVERITY_MASK( SEVERITY ) ( LOG_MASK( SEVERITY ) )
41# define STUMPLESS_SEVERITY_MASK( SEVERITY ) ( 1 << ( SEVERITY ) )
45# ifdef STUMPLESS_SYSLOG_H_COMPATIBLE
46# define STUMPLESS_SEVERITY_MASK_UPTO( SEVERITY ) ( LOG_UPTO( SEVERITY ) )
48# define STUMPLESS_SEVERITY_MASK_UPTO( SEVERITY ) \
49( ( 1 << ( ( SEVERITY ) + 1 ) ) - 1 )
57# ifdef STUMPLESS_SYSLOG_H_COMPATIBLE
58# define STUMPLESS_SEVERITY_EMERG_VALUE LOG_EMERG
60# define STUMPLESS_SEVERITY_EMERG_VALUE 0
68# ifdef STUMPLESS_SYSLOG_H_COMPATIBLE
69# define STUMPLESS_SEVERITY_ALERT_VALUE LOG_ALERT
71# define STUMPLESS_SEVERITY_ALERT_VALUE 1
79# ifdef STUMPLESS_SYSLOG_H_COMPATIBLE
80# define STUMPLESS_SEVERITY_CRIT_VALUE LOG_CRIT
82# define STUMPLESS_SEVERITY_CRIT_VALUE 2
90# ifdef STUMPLESS_SYSLOG_H_COMPATIBLE
91# define STUMPLESS_SEVERITY_ERR_VALUE LOG_ERR
93# define STUMPLESS_SEVERITY_ERR_VALUE 3
101# ifdef STUMPLESS_SYSLOG_H_COMPATIBLE
102# define STUMPLESS_SEVERITY_WARNING_VALUE LOG_WARNING
104# define STUMPLESS_SEVERITY_WARNING_VALUE 4
112# ifdef STUMPLESS_SYSLOG_H_COMPATIBLE
113# define STUMPLESS_SEVERITY_NOTICE_VALUE LOG_NOTICE
115# define STUMPLESS_SEVERITY_NOTICE_VALUE 5
123# ifdef STUMPLESS_SYSLOG_H_COMPATIBLE
124# define STUMPLESS_SEVERITY_INFO_VALUE LOG_INFO
126# define STUMPLESS_SEVERITY_INFO_VALUE 6
134# ifdef STUMPLESS_SYSLOG_H_COMPATIBLE
135# define STUMPLESS_SEVERITY_DEBUG_VALUE LOG_DEBUG
137# define STUMPLESS_SEVERITY_DEBUG_VALUE 7
146# define STUMPLESS_SEVERITY_TRACE_VALUE STUMPLESS_SEVERITY_DEBUG_VALUE
156# define STUMPLESS_FOREACH_SEVERITY( ACTION ) \
158ACTION( STUMPLESS_SEVERITY_EMERG, STUMPLESS_SEVERITY_EMERG_VALUE ) \
160ACTION( STUMPLESS_SEVERITY_ALERT, STUMPLESS_SEVERITY_ALERT_VALUE ) \
162ACTION( STUMPLESS_SEVERITY_CRIT, STUMPLESS_SEVERITY_CRIT_VALUE ) \
164ACTION( STUMPLESS_SEVERITY_ERR, STUMPLESS_SEVERITY_ERR_VALUE ) \
166ACTION( STUMPLESS_SEVERITY_WARNING, STUMPLESS_SEVERITY_WARNING_VALUE ) \
168ACTION( STUMPLESS_SEVERITY_NOTICE, STUMPLESS_SEVERITY_NOTICE_VALUE ) \
170ACTION( STUMPLESS_SEVERITY_INFO, STUMPLESS_SEVERITY_INFO_VALUE ) \
172ACTION( STUMPLESS_SEVERITY_DEBUG, STUMPLESS_SEVERITY_DEBUG_VALUE )
199# define STUMPLESS_SEVERITY_TRACE STUMPLESS_SEVERITY_DEBUG
#define STUMPLESS_PUBLIC_FUNCTION
Marks functions that are provided for use by the library.
Definition config.h:31
Generic functionality to be used with STUMPLESS_FOREACH macros to allow for more generic definition o...
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.
#define STUMPLESS_FOREACH_SEVERITY(ACTION)
A macro function that runs the provided action once for each severity, providing the symbol and value...
Definition severity.h:156
stumpless_severity
All possible severity codes available to log entries.
Definition severity.h:189
@ STUMPLESS_GENERATE_ENUM
Emergency: system is unusable.
Definition severity.h:190
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.