10 FILE_LICENCE ( GPL2_OR_LATER );
13 #include <ipxe/ansiesc.h>
14 #include <config/console.h>
17 * @defgroup syslogpri Syslog priorities
19 * These values are chosen to match those used in the syslog network
20 * protocol (RFC 5424).
25 /** Emergency: system is unusable */
28 /** Alert: action must be taken immediately */
31 /** Critical: critical conditions */
34 /** Error: error conditions */
37 /** Warning: warning conditions */
40 /** Notice: normal but significant conditions */
43 /** Informational: informational messages */
46 /** Debug: debug-level messages */
51 /** Do not log any messages */
54 /** Log all messages */
55 #define LOG_ALL LOG_DEBUG
57 extern void log_vprintf ( const char *fmt, va_list args );
59 extern void __attribute__ (( format ( printf, 1, 2 ) ))
60 log_printf ( const char *fmt, ... );
62 /** ANSI private escape sequence to set syslog priority
64 * @v priority Priority
66 #define SYSLOG_SET_PRIORITY( priority ) \
69 /** ANSI private escape sequence to clear syslog priority */
70 #define SYSLOG_CLEAR_PRIORITY "\033[p"
73 * Write message to system log
75 * @v priority Message priority
76 * @v fmt Format string
79 #define vsyslog( priority, fmt, args ) do { \
80 if ( (priority) <= LOG_LEVEL ) { \
81 log_vprintf ( SYSLOG_SET_PRIORITY ( priority ) fmt \
82 SYSLOG_CLEAR_PRIORITY, (args) ); \
87 * Write message to system log
89 * @v priority Message priority
90 * @v fmt Format string
93 #define syslog( priority, fmt, ... ) do { \
94 if ( (priority) <= LOG_LEVEL ) { \
95 log_printf ( SYSLOG_SET_PRIORITY ( priority ) fmt \
96 SYSLOG_CLEAR_PRIORITY, ##__VA_ARGS__ ); \
100 #endif /* _SYSLOG_H */