/* * Copyright (C) 2013 Red Hat, Inc. * Authors: * Thomas Woerner * * 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 . * */ #ifndef FWLOG_H #define FWLOG_H #define FWLOG_FATAL 0 #define FWLOG_ERROR 1 #define FWLOG_WARNING 2 #define FWLOG_INFO 3 #define FWLOG_DEBUG 4 #define FWLOG_NO_INFO 0 #define FWLOG_INFO_MAX 5 #define FWLOG_NO_DEBUG 0 #define FWLOG_DEBUG_MAX 10 extern int fwlog_level_info; extern int fwlog_level_debug; void fwlog_set_info_level(int level); void fwlog_set_debug_level(int level); void fwlog_init(int info_level, int debug_level); int fwlog_log(int priority, int level, const char *format, ...); #define fwlog_fatal(...) fwlog_log(FWLOG_FATAL, 0, __VA_ARGS__) #define fwlog_error(...) fwlog_log(FWLOG_ERROR, 0, __VA_ARGS__) #define fwlog_warning(...) fwlog_log(FWLOG_WARNING, 0, __VA_ARGS__) #define fwlog_info(level, ...) \ do { \ if (fwlog_level_info >= level) \ fwlog_log(FWLOG_INFO, level, __VA_ARGS__); \ } while(0) #define fwlog_info1(...) fwlog_info(1, __VA_ARGS__) #define fwlog_info2(...) fwlog_info(2, __VA_ARGS__) #define fwlog_info3(...) fwlog_info(3, __VA_ARGS__) #define fwlog_info4(...) fwlog_info(4, __VA_ARGS__) #define fwlog_info5(...) fwlog_info(5, __VA_ARGS__) #define fwlog_debug(level, ...) \ do { \ if (fwlog_level_debug >= level) \ fwlog_log(FWLOG_DEBUG, level, __VA_ARGS__); \ } while(0) #define fwlog_debug1(...) fwlog_debug(1, __VA_ARGS__) #define fwlog_debug2(...) fwlog_debug(2, __VA_ARGS__) #define fwlog_debug3(...) fwlog_debug(3, __VA_ARGS__) #define fwlog_debug4(...) fwlog_debug(4, __VA_ARGS__) #define fwlog_debug5(...) fwlog_debug(5, __VA_ARGS__) #define fwlog_debug6(...) fwlog_debug(6, __VA_ARGS__) #define fwlog_debug7(...) fwlog_debug(7, __VA_ARGS__) #define fwlog_debug8(...) fwlog_debug(8, __VA_ARGS__) #define fwlog_debug9(...) fwlog_debug(9, __VA_ARGS__) #define fwlog_debug10(...) fwlog_debug(10, __VA_ARGS__) #endif