iPXE
Defines | Functions
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.

Defines

#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)   "\033[" #priority "p"
 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)
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.


Define Documentation

#define LOG_NONE   -1

Do not log any messages.

Definition at line 52 of file syslog.h.

#define LOG_ALL   LOG_DEBUG

Log all messages.

Definition at line 55 of file syslog.h.

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

ANSI private escape sequence to set syslog priority.

Parameters:
priorityPriority

Definition at line 66 of file syslog.h.

#define SYSLOG_CLEAR_PRIORITY   "\033[p"

ANSI private escape sequence to clear syslog priority.

Definition at line 70 of file syslog.h.

#define vsyslog (   priority,
  fmt,
  args 
)
Value:
do {                            \
        if ( (priority) <= LOG_LEVEL ) {                                \
                log_vprintf ( SYSLOG_SET_PRIORITY ( priority ) fmt      \
                              SYSLOG_CLEAR_PRIORITY, (args) );          \
        }                                                               \
        } while ( 0 )

Write message to system log.

Parameters:
priorityMessage priority
fmtFormat string
...Arguments

Definition at line 79 of file syslog.h.

#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 93 of file syslog.h.

Referenced by downloader_finished(), image_exec(), and imgverify().


Function Documentation

FILE_LICENCE ( GPL2_OR_LATER_OR_UBDL  )
void log_vprintf ( const char *  fmt,
va_list  args 
)

Write message to system log.

Parameters:
fmtFormat string
argsArguments

Definition at line 42 of file log.c.

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

Referenced by log_printf().

                                                   {
        int saved_usage;

        /* Mark console as in use for log messages */
        saved_usage = console_set_usage ( CONSOLE_USAGE_LOG );

        /* Print message */
        vprintf ( fmt, args );

        /* Restore console usage */
        console_set_usage ( saved_usage );
}
void __attribute__ ( (format(printf, 1, 2))  ) const