CardSight 0.1.0
C API reference for the CardSight firmware and application
Loading...
Searching...
No Matches
log.h
Go to the documentation of this file.
1/* SPDX-License-Identifier: GPL-2.0-or-later */
9
10#ifndef CARDSIGHT_LOG_H
11#define CARDSIGHT_LOG_H
12
13#include <stdio.h>
14
16#define LOG_LEVEL_ERROR 1
18#define LOG_LEVEL_WARN 2
20#define LOG_LEVEL_INFO 3
22#define LOG_LEVEL_DEBUG 4
23
25#ifndef CONFIG_LOG_LEVEL
26#define CONFIG_LOG_LEVEL LOG_LEVEL_INFO
27#endif
28
30#ifndef LOG_MODULE
31#define LOG_MODULE "kernel"
32#endif
33
46void log_print(int level, const char *module, const char *format, ...)
47 __attribute__((format(printf, 3, 4)));
48
50#define pr_err(format, ...) log_print(LOG_LEVEL_ERROR, LOG_MODULE, format, ##__VA_ARGS__)
52#define pr_warn(format, ...) log_print(LOG_LEVEL_WARN, LOG_MODULE, format, ##__VA_ARGS__)
54#define pr_info(format, ...) log_print(LOG_LEVEL_INFO, LOG_MODULE, format, ##__VA_ARGS__)
56#define pr_debug(format, ...) log_print(LOG_LEVEL_DEBUG, LOG_MODULE, format, ##__VA_ARGS__)
57
58#endif /* CARDSIGHT_LOG_H */
void log_print(int level, const char *module, const char *format,...) __attribute__((format(printf
Print one formatted log message to the console.