blob: d55a4c6fd1c3f27f14db01ba32bfa7fc4653eb47 [file] [log] [blame]
Lucas De Marchi84341fb2012-11-06 17:08:43 -02001/*
2 * kmod - log infrastructure
3 *
Lucas De Marchie6b0e492013-01-16 11:27:21 -02004 * Copyright (C) 2012-2013 ProFUSION embedded systems
Lucas De Marchi84341fb2012-11-06 17:08:43 -02005 *
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 Marchifcb0ce92012-11-06 19:01:59 -020020#include <stdarg.h>
Lucas De Marchi92aad742012-11-06 18:04:09 -020021#include <stdbool.h>
Lucas De Marchi84341fb2012-11-06 17:08:43 -020022#include <stdio.h>
23#include <syslog.h>
24
25#include "kmod.h"
26
Lucas De Marchi92aad742012-11-06 18:04:09 -020027void log_open(bool use_syslog);
28void log_close(void);
Lucas De Marchi1958af82013-04-21 16:16:18 -030029void log_printf(int prio, const char *fmt, ...) _printf_format_(2, 3);
Lucas De Marchifcb0ce92012-11-06 19:01:59 -020030#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 Marchi92aad742012-11-06 18:04:09 -020035
Lucas De Marchi52a50fe2012-11-06 18:26:34 -020036struct kmod_ctx;
37void log_setup_kmod_log(struct kmod_ctx *ctx, int priority);