Defines | |
| #define | di_error(format...) di_log (DI_LOG_LEVEL_ERROR, format) |
| #define | di_warning(format...) di_log (DI_LOG_LEVEL_WARNING, format) |
| #define | di_info(format...) di_log (DI_LOG_LEVEL_INFO, format) |
| #define | di_debug(format...) di_log (DI_LOG_LEVEL_DEBUG, format) |
Typedefs | |
| typedef void | di_log_handler (di_log_level_flags log_level, const char *message, void *user_data) |
Enumerations | |
| enum | di_log_level_flags { DI_LOG_FLAG_FATAL = 1 << 1, DI_LOG_LEVEL_ERROR = 1 << 2, DI_LOG_LEVEL_CRITICAL = 1 << 3, DI_LOG_LEVEL_WARNING = 1 << 4, DI_LOG_LEVEL_MESSAGE = 1 << 5, DI_LOG_LEVEL_INFO = 1 << 6, DI_LOG_LEVEL_DEBUG = 1 << 7, DI_LOG_LEVEL_OUTPUT = 1 << 8, DI_LOG_LEVEL_MASK = ~DI_LOG_FLAG_FATAL, DI_LOG_FATAL_MASK = DI_LOG_LEVEL_ERROR } |
| Log levels and other flags. More... | |
Functions | |
| void | di_log (di_log_level_flags log_level, const char *format,...) __attribute__((format(printf |
| void | di_vlog (di_log_level_flags log_level, const char *format, va_list args) |
| unsigned int | di_log_set_handler (di_log_level_flags log_levels, di_log_handler *log_func, void *user_data) |
Variables | |
| di_log_handler | di_log_handler_default |
| di_log_handler | di_log_handler_syslog |
|
|
logs debug info |
|
|
logs an error |
|
|
logs information |
|
|
logs a warning |
|
|
Log levels and other flags.
00037 {
00038 DI_LOG_FLAG_FATAL = 1 << 1,
00040 DI_LOG_LEVEL_ERROR = 1 << 2,
00041 DI_LOG_LEVEL_CRITICAL = 1 << 3,
00042 DI_LOG_LEVEL_WARNING = 1 << 4,
00043 DI_LOG_LEVEL_MESSAGE = 1 << 5,
00044 DI_LOG_LEVEL_INFO = 1 << 6,
00045 DI_LOG_LEVEL_DEBUG = 1 << 7,
00046 DI_LOG_LEVEL_OUTPUT = 1 << 8,
00048 DI_LOG_LEVEL_MASK = ~DI_LOG_FLAG_FATAL,
00049 DI_LOG_FATAL_MASK = DI_LOG_LEVEL_ERROR,
00050 }
|
|
||||||||||||||||
|
Logs the resolved formatstring with log_level
|
|
||||||||||||||||
|
Sets a log handler
00193 {
00194 static unsigned int handler_id = 0;
00195 di_log_handler_struct *handler;
00196
00197 handler = di_new (di_log_handler_struct, 1);
00198
00199 handler->id = ++handler_id;
00200 handler->log_level = log_levels;
00201 handler->log_func = log_func;
00202 handler->user_data = user_data;
00203
00204 di_slist_append (&handlers, handler);
00205
00206 return handler_id;
00207 }
|
|
||||||||||||||||
|
Logs the resolved formatstring with log_level
00221 {
00222 char buf[1024];
00223 int fatal = log_level & DI_LOG_FATAL_MASK;
00224 di_log_handler *log_func;
00225 void *user_data;
00226
00227 vsnprintf (buf, sizeof (buf), format, args);
00228
00229 log_func = internal_di_log_get_handler (log_level, &user_data);
00230
00231 log_func (log_level, buf, user_data);
00232
00233 if (fatal)
00234 exit (1);
00235 }
|
|
|
Default log handler. Logs to STDOUT and STDERR. |
|
|
SYSLOG log handler. Logs to SYSLOG. |
1.3.6-20040222