log.h
/*
* log.h
*
* Copyright (C) 2003 Bastian Blank <waldi@debian.org>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef DEBIAN_INSTALLER__LOG_H
#define DEBIAN_INSTALLER__LOG_H
#include <stdarg.h>
typedef enum
{
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,
}
di_log_level_flags;
typedef void di_log_handler (di_log_level_flags log_level, const char *message, void *user_data);
#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)
void di_log (di_log_level_flags log_level, const char *format, ...) __attribute__ ((format(printf,2,3)));
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);
di_log_handler
di_log_handler_default,
di_log_handler_syslog;
#endif
di_log_set_handler
unsigned int di_log_set_handler(di_log_level_flags log_levels, di_log_handler *log_func, void *user_data)
Definition: log.c:189
di_log_handler_default
di_log_handler di_log_handler_default
Definition: log.h:99
di_vlog
void void di_vlog(di_log_level_flags log_level, const char *format, va_list args)
Definition: log.c:217
di_log
void di_log(di_log_level_flags log_level, const char *format,...) __attribute__((format(printf
di_log_handler_syslog
di_log_handler di_log_handler_syslog
Definition: log.h:104
di_log_level_flags
di_log_level_flags
Log levels and other flags.
Definition: log.h:34
DI_LOG_LEVEL_MASK
@ DI_LOG_LEVEL_MASK
Definition: log.h:45
DI_LOG_LEVEL_WARNING
@ DI_LOG_LEVEL_WARNING
Definition: log.h:39
DI_LOG_LEVEL_MESSAGE
@ DI_LOG_LEVEL_MESSAGE
Definition: log.h:40
DI_LOG_FLAG_FATAL
@ DI_LOG_FLAG_FATAL
Definition: log.h:35
DI_LOG_LEVEL_INFO
@ DI_LOG_LEVEL_INFO
Definition: log.h:41
DI_LOG_LEVEL_ERROR
@ DI_LOG_LEVEL_ERROR
Definition: log.h:37
DI_LOG_LEVEL_CRITICAL
@ DI_LOG_LEVEL_CRITICAL
Definition: log.h:38
DI_LOG_FATAL_MASK
@ DI_LOG_FATAL_MASK
Definition: log.h:46
DI_LOG_LEVEL_DEBUG
@ DI_LOG_LEVEL_DEBUG
Definition: log.h:42
DI_LOG_LEVEL_OUTPUT
@ DI_LOG_LEVEL_OUTPUT
Definition: log.h:43