libkmod-module: convert return value from system() to errno
[platform/upstream/kmod.git] / tools / log.h
1 /*
2  * kmod - log infrastructure
3  *
4  * Copyright (C) 2012-2013  ProFUSION embedded systems
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
20 #include <stdarg.h>
21 #include <stdbool.h>
22 #include <stdio.h>
23 #include <syslog.h>
24
25 #include "kmod.h"
26
27 void log_open(bool use_syslog);
28 void log_close(void);
29 void log_printf(int prio, const char *fmt, ...) _printf_format_(2, 3);
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__)
35
36 struct kmod_ctx;
37 void log_setup_kmod_log(struct kmod_ctx *ctx, int priority);