Lucas De Marchi | 84341fb | 2012-11-06 17:08:43 -0200 | [diff] [blame] | 1 | /* |
| 2 | * kmod - log infrastructure |
| 3 | * |
Lucas De Marchi | e6b0e49 | 2013-01-16 11:27:21 -0200 | [diff] [blame] | 4 | * Copyright (C) 2012-2013 ProFUSION embedded systems |
Lucas De Marchi | 84341fb | 2012-11-06 17:08:43 -0200 | [diff] [blame] | 5 | * |
| 6 | * This program is free software: you can redistribute it and/or modify |
| 7 | * it under the terms of the GNU General Public License as published by |
| 8 | * the Free Software Foundation, either version 2 of the License, or |
| 9 | * (at your option) any later version. |
| 10 | * |
| 11 | * This program is distributed in the hope that it will be useful, |
| 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 14 | * GNU General Public License for more details. |
| 15 | * |
| 16 | * You should have received a copy of the GNU General Public License |
| 17 | * along with this program. If not, see <http://www.gnu.org/licenses/>. |
| 18 | */ |
| 19 | |
Lucas De Marchi | fcb0ce9 | 2012-11-06 19:01:59 -0200 | [diff] [blame] | 20 | #include <stdarg.h> |
Lucas De Marchi | 92aad74 | 2012-11-06 18:04:09 -0200 | [diff] [blame] | 21 | #include <stdbool.h> |
Lucas De Marchi | 84341fb | 2012-11-06 17:08:43 -0200 | [diff] [blame] | 22 | #include <stdio.h> |
| 23 | #include <syslog.h> |
| 24 | |
| 25 | #include "kmod.h" |
| 26 | |
Lucas De Marchi | 92aad74 | 2012-11-06 18:04:09 -0200 | [diff] [blame] | 27 | void log_open(bool use_syslog); |
| 28 | void log_close(void); |
Lucas De Marchi | 1958af8 | 2013-04-21 16:16:18 -0300 | [diff] [blame] | 29 | void log_printf(int prio, const char *fmt, ...) _printf_format_(2, 3); |
Lucas De Marchi | fcb0ce9 | 2012-11-06 19:01:59 -0200 | [diff] [blame] | 30 | #define CRIT(...) log_printf(LOG_CRIT, __VA_ARGS__) |
| 31 | #define ERR(...) log_printf(LOG_ERR, __VA_ARGS__) |
| 32 | #define WRN(...) log_printf(LOG_WARNING, __VA_ARGS__) |
| 33 | #define INF(...) log_printf(LOG_INFO, __VA_ARGS__) |
| 34 | #define DBG(...) log_printf(LOG_DEBUG, __VA_ARGS__) |
Lucas De Marchi | 92aad74 | 2012-11-06 18:04:09 -0200 | [diff] [blame] | 35 | |
Lucas De Marchi | 52a50fe | 2012-11-06 18:26:34 -0200 | [diff] [blame] | 36 | struct kmod_ctx; |
| 37 | void log_setup_kmod_log(struct kmod_ctx *ctx, int priority); |