stumpless  2.1.0
Macros | Enumerations | Functions
severity.h File Reference
#include <stumpless/config.h>
#include <stumpless/generator.h>
#include <syslog.h>

Go to the source code of this file.

Macros

#define STUMPLESS_SEVERITY_MASK(SEVERITY)   ( LOG_MASK( SEVERITY ) )
 Creates a severity mask for the provided severity. More...
 
#define STUMPLESS_SEVERITY_MASK_UPTO(SEVERITY)   ( LOG_UPTO( SEVERITY ) )
 Creates a severity mask from EMERG up to the provided severity. More...
 
#define STUMPLESS_SEVERITY_EMERG_VALUE   LOG_EMERG
 Severity code value for EMERG log entries. More...
 
#define STUMPLESS_SEVERITY_ALERT_VALUE   LOG_ALERT
 Severity code value for ALERT log entries. More...
 
#define STUMPLESS_SEVERITY_CRIT_VALUE   LOG_CRIT
 Severity code value for CRIT log entries. More...
 
#define STUMPLESS_SEVERITY_ERR_VALUE   LOG_ERR
 Severity code value for ERR log entries. More...
 
#define STUMPLESS_SEVERITY_WARNING_VALUE   LOG_WARNING
 Severity code value for WARNING log entries. More...
 
#define STUMPLESS_SEVERITY_NOTICE_VALUE   LOG_NOTICE
 Severity code value for NOTICE log entries. More...
 
#define STUMPLESS_SEVERITY_INFO_VALUE   LOG_INFO
 Severity code value for INFO log entries. More...
 
#define STUMPLESS_SEVERITY_DEBUG_VALUE   LOG_DEBUG
 Severity code value for DEBUG log entries. More...
 
#define STUMPLESS_SEVERITY_TRACE_VALUE   STUMPLESS_SEVERITY_DEBUG_VALUE
 Equivalent to the DEBUG severity code value. More...
 
#define STUMPLESS_FOREACH_SEVERITY(ACTION)
 A macro function that runs the provided action once for each severity, providing the symbol and value. More...
 
#define STUMPLESS_SEVERITY_TRACE   STUMPLESS_SEVERITY_DEBUG
 Equivalent to the DEBUG severity. More...
 

Enumerations

enum  stumpless_severity {
  STUMPLESS_SEVERITY_EMERG = ( LOG_EMERG ), STUMPLESS_SEVERITY_ALERT = ( LOG_ALERT ), STUMPLESS_SEVERITY_CRIT = ( LOG_CRIT ), STUMPLESS_SEVERITY_ERR = ( LOG_ERR ),
  STUMPLESS_SEVERITY_WARNING = ( LOG_WARNING ), STUMPLESS_SEVERITY_NOTICE = ( LOG_NOTICE ), STUMPLESS_SEVERITY_INFO = ( LOG_INFO ), STUMPLESS_SEVERITY_DEBUG = ( LOG_DEBUG )
}
 All possible severity codes available to log entries. More...
 

Functions

const char * stumpless_get_severity_string (enum stumpless_severity severity)
 Gets the string representation of the given severity. More...
 
enum stumpless_severity stumpless_get_severity_enum (const char *severity_string)
 Gets the enum value corresponding to the given severity string. More...
 

Detailed Description

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.

Macro Definition Documentation

◆ STUMPLESS_FOREACH_SEVERITY

#define STUMPLESS_FOREACH_SEVERITY (   ACTION)
Value:

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.

Since
release v2.0.0.

◆ STUMPLESS_SEVERITY_ALERT_VALUE

#define STUMPLESS_SEVERITY_ALERT_VALUE   LOG_ALERT

Severity code value for ALERT log entries.

Since
release v2.0.0.

◆ STUMPLESS_SEVERITY_CRIT_VALUE

#define STUMPLESS_SEVERITY_CRIT_VALUE   LOG_CRIT

Severity code value for CRIT log entries.

Since
release v2.0.0.

◆ STUMPLESS_SEVERITY_DEBUG_VALUE

#define STUMPLESS_SEVERITY_DEBUG_VALUE   LOG_DEBUG

Severity code value for DEBUG log entries.

Since
release v2.0.0.

◆ STUMPLESS_SEVERITY_EMERG_VALUE

#define STUMPLESS_SEVERITY_EMERG_VALUE   LOG_EMERG

Severity code value for EMERG log entries.

Since
release v2.0.0.

◆ STUMPLESS_SEVERITY_ERR_VALUE

#define STUMPLESS_SEVERITY_ERR_VALUE   LOG_ERR

Severity code value for ERR log entries.

Since
release v2.0.0.

◆ STUMPLESS_SEVERITY_INFO_VALUE

#define STUMPLESS_SEVERITY_INFO_VALUE   LOG_INFO

Severity code value for INFO log entries.

Since
release v2.0.0.

◆ STUMPLESS_SEVERITY_MASK

#define STUMPLESS_SEVERITY_MASK (   SEVERITY)    ( LOG_MASK( SEVERITY ) )

Creates a severity mask for the provided severity.

◆ STUMPLESS_SEVERITY_MASK_UPTO

#define STUMPLESS_SEVERITY_MASK_UPTO (   SEVERITY)    ( LOG_UPTO( SEVERITY ) )

Creates a severity mask from EMERG up to the provided severity.

◆ STUMPLESS_SEVERITY_NOTICE_VALUE

#define STUMPLESS_SEVERITY_NOTICE_VALUE   LOG_NOTICE

Severity code value for NOTICE log entries.

Since
release v2.0.0.

◆ STUMPLESS_SEVERITY_TRACE

#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.

Since
release v2.1.0

◆ STUMPLESS_SEVERITY_TRACE_VALUE

#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.

Since
release v2.1.0

◆ STUMPLESS_SEVERITY_WARNING_VALUE

#define STUMPLESS_SEVERITY_WARNING_VALUE   LOG_WARNING

Severity code value for WARNING log entries.

Since
release v2.0.0.

Enumeration Type Documentation

◆ 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.

Since
release v2.0.0.
Enumerator
STUMPLESS_SEVERITY_EMERG 

Emergency: system is unusable.

STUMPLESS_SEVERITY_ALERT 

Alert: action must be taken immediately.

STUMPLESS_SEVERITY_CRIT 

Critical: critical conditions.

STUMPLESS_SEVERITY_ERR 

Error: error conditions.

STUMPLESS_SEVERITY_WARNING 

Warning: warning conditions.

STUMPLESS_SEVERITY_NOTICE 

Notice: normal but significant condition.

STUMPLESS_SEVERITY_INFO 

Informational: informational messages.

STUMPLESS_SEVERITY_DEBUG 

Debug: debug-level messages.

Function Documentation

◆ stumpless_get_severity_enum()

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.

Since
release v2.1.0.
Parameters
severity_stringThe severity name to get the enum from.
Returns
The enum integer corresponding to the given severity or -1 if the string is not a valid severity name.

◆ stumpless_get_severity_string()

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.

Parameters
severityThe severity to get the string from.
Returns
The string representation of the given severity.
STUMPLESS_SEVERITY_DEBUG_VALUE
#define STUMPLESS_SEVERITY_DEBUG_VALUE
Severity code value for DEBUG log entries.
Definition: severity.h:134
STUMPLESS_SEVERITY_DEBUG
@ STUMPLESS_SEVERITY_DEBUG
Debug: debug-level messages.
Definition: severity.h:186
STUMPLESS_SEVERITY_INFO_VALUE
#define STUMPLESS_SEVERITY_INFO_VALUE
Severity code value for INFO log entries.
Definition: severity.h:123
STUMPLESS_SEVERITY_NOTICE
@ STUMPLESS_SEVERITY_NOTICE
Notice: normal but significant condition.
Definition: severity.h:186
STUMPLESS_SEVERITY_ERR_VALUE
#define STUMPLESS_SEVERITY_ERR_VALUE
Severity code value for ERR log entries.
Definition: severity.h:90
STUMPLESS_SEVERITY_NOTICE_VALUE
#define STUMPLESS_SEVERITY_NOTICE_VALUE
Severity code value for NOTICE log entries.
Definition: severity.h:112
STUMPLESS_SEVERITY_CRIT
@ STUMPLESS_SEVERITY_CRIT
Critical: critical conditions.
Definition: severity.h:186
STUMPLESS_SEVERITY_ALERT
@ STUMPLESS_SEVERITY_ALERT
Alert: action must be taken immediately.
Definition: severity.h:186
STUMPLESS_SEVERITY_WARNING_VALUE
#define STUMPLESS_SEVERITY_WARNING_VALUE
Severity code value for WARNING log entries.
Definition: severity.h:101
STUMPLESS_SEVERITY_ERR
@ STUMPLESS_SEVERITY_ERR
Error: error conditions.
Definition: severity.h:186
STUMPLESS_SEVERITY_CRIT_VALUE
#define STUMPLESS_SEVERITY_CRIT_VALUE
Severity code value for CRIT log entries.
Definition: severity.h:79
STUMPLESS_SEVERITY_INFO
@ STUMPLESS_SEVERITY_INFO
Informational: informational messages.
Definition: severity.h:186
STUMPLESS_SEVERITY_EMERG_VALUE
#define STUMPLESS_SEVERITY_EMERG_VALUE
Severity code value for EMERG log entries.
Definition: severity.h:57
STUMPLESS_SEVERITY_WARNING
@ STUMPLESS_SEVERITY_WARNING
Warning: warning conditions.
Definition: severity.h:186
STUMPLESS_SEVERITY_EMERG
@ STUMPLESS_SEVERITY_EMERG
Emergency: system is unusable.
Definition: severity.h:186
STUMPLESS_SEVERITY_ALERT_VALUE
#define STUMPLESS_SEVERITY_ALERT_VALUE
Severity code value for ALERT log entries.
Definition: severity.h:68