00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020 #ifndef DEBIAN_INSTALLER__LOG_H
00021 #define DEBIAN_INSTALLER__LOG_H
00022
00023 #include <stdarg.h>
00024
00033 typedef enum
00034 {
00035 DI_LOG_FLAG_FATAL = 1 << 1,
00037 DI_LOG_LEVEL_ERROR = 1 << 2,
00038 DI_LOG_LEVEL_CRITICAL = 1 << 3,
00039 DI_LOG_LEVEL_WARNING = 1 << 4,
00040 DI_LOG_LEVEL_MESSAGE = 1 << 5,
00041 DI_LOG_LEVEL_INFO = 1 << 6,
00042 DI_LOG_LEVEL_DEBUG = 1 << 7,
00043 DI_LOG_LEVEL_OUTPUT = 1 << 8,
00045 DI_LOG_LEVEL_MASK = ~DI_LOG_FLAG_FATAL,
00046 DI_LOG_FATAL_MASK = DI_LOG_LEVEL_ERROR,
00047 }
00048 di_log_level_flags;
00049
00050 typedef void di_log_handler (di_log_level_flags log_level, const char *message, void *user_data);
00051
00055 #define di_error(format...) di_log (DI_LOG_LEVEL_ERROR, format)
00056
00059 #define di_warning(format...) di_log (DI_LOG_LEVEL_WARNING, format)
00060
00063 #define di_info(format...) di_log (DI_LOG_LEVEL_INFO, format)
00064
00067 #define di_debug(format...) di_log (DI_LOG_LEVEL_DEBUG, format)
00068
00075 void di_log (di_log_level_flags log_level, const char *format, ...) __attribute__ ((format(printf,2,3)));
00083 void di_vlog (di_log_level_flags log_level, const char *format, va_list args);
00084
00092 unsigned int di_log_set_handler (di_log_level_flags log_levels, di_log_handler *log_func, void *user_data);
00093
00094 di_log_handler
00099 di_log_handler_default,
00104 di_log_handler_syslog;
00105
00107 #endif