iPXE
syslog.h File Reference

System logger. More...

#include <stdarg.h>
#include <ipxe/ansiesc.h>
#include <config/console.h>

Go to the source code of this file.

Macros

#define LOG_EMERG   0
 Emergency: system is unusable.
#define LOG_ALERT   1
 Alert: action must be taken immediately.
#define LOG_CRIT   2
 Critical: critical conditions.
#define LOG_ERR   3
 Error: error conditions.
#define LOG_WARNING   4
 Warning: warning conditions.
#define LOG_NOTICE   5
 Notice: normal but significant conditions.
#define LOG_INFO   6
 Informational: informational messages.
#define LOG_DEBUG   7
 Debug: debug-level messages.
#define LOG_NONE   -1
 Do not log any messages.
#define LOG_ALL   LOG_DEBUG
 Log all messages.
#define SYSLOG_SET_PRIORITY(priority)
 ANSI private escape sequence to set syslog priority.
#define SYSLOG_CLEAR_PRIORITY   "\033[p"
 ANSI private escape sequence to clear syslog priority.
#define vsyslog(priority, fmt, args)
 Write message to system log.
#define syslog(priority, fmt, ...)
 Write message to system log.

Functions

 FILE_LICENCE (GPL2_OR_LATER_OR_UBDL)
 FILE_SECBOOT (PERMITTED)
void log_vprintf (const char *fmt, va_list args)
 Write message to system log.
void __attribute__ ((format(printf, 1, 2))) log_printf(const char *fmt

Detailed Description

System logger.

Definition in file syslog.h.

Macro Definition Documentation

◆ LOG_NONE

#define LOG_NONE   -1

Do not log any messages.

Definition at line 53 of file syslog.h.

◆ LOG_ALL

#define LOG_ALL   LOG_DEBUG

Log all messages.

Definition at line 56 of file syslog.h.

◆ SYSLOG_SET_PRIORITY

#define SYSLOG_SET_PRIORITY ( priority)
Value:
"\033[" #priority "p"
uint16_t priority
Priotity.
Definition stp.h:1

ANSI private escape sequence to set syslog priority.

Parameters
priorityPriority

Definition at line 67 of file syslog.h.

67#define SYSLOG_SET_PRIORITY( priority ) \
68 "\033[" #priority "p"

◆ SYSLOG_CLEAR_PRIORITY

#define SYSLOG_CLEAR_PRIORITY   "\033[p"

ANSI private escape sequence to clear syslog priority.

Definition at line 71 of file syslog.h.

◆ vsyslog

#define vsyslog ( priority,
fmt,
args )
Value:
do { \
if ( (priority) <= LOG_LEVEL ) { \
log_vprintf ( SYSLOG_SET_PRIORITY ( priority ) fmt \
SYSLOG_CLEAR_PRIORITY, (args) ); \
} \
} while ( 0 )
#define LOG_LEVEL
Definition console.h:95
#define SYSLOG_SET_PRIORITY(priority)
ANSI private escape sequence to set syslog priority.
Definition syslog.h:67
#define SYSLOG_CLEAR_PRIORITY
ANSI private escape sequence to clear syslog priority.
Definition syslog.h:71
int ssize_t const char * fmt
Definition vsprintf.h:73

Write message to system log.

Parameters
priorityMessage priority
fmtFormat string
...Arguments

Definition at line 80 of file syslog.h.

80#define vsyslog( priority, fmt, args ) do { \
81 if ( (priority) <= LOG_LEVEL ) { \
82 log_vprintf ( SYSLOG_SET_PRIORITY ( priority ) fmt \
83 SYSLOG_CLEAR_PRIORITY, (args) ); \
84 } \
85 } while ( 0 )

◆ syslog

#define syslog ( priority,
fmt,
... )
Value:
do { \
if ( (priority) <= LOG_LEVEL ) { \
log_printf ( SYSLOG_SET_PRIORITY ( priority ) fmt \
SYSLOG_CLEAR_PRIORITY, ##__VA_ARGS__ ); \
} \
} while ( 0 )

Write message to system log.

Parameters
priorityMessage priority
fmtFormat string
...Arguments

Definition at line 94 of file syslog.h.

94#define syslog( priority, fmt, ... ) do { \
95 if ( (priority) <= LOG_LEVEL ) { \
96 log_printf ( SYSLOG_SET_PRIORITY ( priority ) fmt \
97 SYSLOG_CLEAR_PRIORITY, ##__VA_ARGS__ ); \
98 } \
99 } while ( 0 )

Referenced by __setting(), downloader_finished(), image_exec(), imgdecrypt(), imgverify(), and PROVIDE_REQUIRING_SYMBOL().

Function Documentation

◆ FILE_LICENCE()

FILE_LICENCE ( GPL2_OR_LATER_OR_UBDL )

◆ FILE_SECBOOT()

FILE_SECBOOT ( PERMITTED )

◆ log_vprintf()

void log_vprintf ( const char * fmt,
va_list args )
extern

Write message to system log.

Parameters
fmtFormat string
argsArguments

Definition at line 42 of file log.c.

42 {
43 int saved_usage;
44
45 /* Mark console as in use for log messages */
47
48 /* Print message */
49 vprintf ( fmt, args );
50
51 /* Restore console usage */
53}
static unsigned int saved_usage
Definition ansi_screen.c:14
#define CONSOLE_USAGE_LOG
Log messages.
Definition console.h:151
static int console_set_usage(int usage)
Set console usage.
Definition console.h:188
int vprintf(const char *fmt, va_list args)
Write a formatted string to the console.
Definition vsprintf.c:450

References console_set_usage(), CONSOLE_USAGE_LOG, fmt, saved_usage, and vprintf().

Referenced by log_printf().

◆ __attribute__()

void __attribute__ ( (format(printf, 1, 2)) ) const
extern

References fmt, format, log_printf(), and printf().