k_log.h
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2015 Kaspar Schleiser <[email protected]>
3  *
4  * This file is subject to the terms and conditions of the GNU Lesser
5  * General Public License v2.1. See the file LICENSE in the top level
6  * directory for more details.
7  */
8 
36 #ifndef LOG_H
37 #define LOG_H
38 
39 #ifdef __cplusplus
40  extern "C" {
41 #endif
42 
55 enum {
68 };
69 
70 #ifndef LOG_LEVEL
71 
74 #define LOG_LEVEL LOG_INFO
75 #endif
76 
80 #define LOG(level, ...) if (level <= LOG_LEVEL) log_write(level, __VA_ARGS__)
81 
86 #define LOG_ERROR(...) LOG(LOG_ERROR, __VA_ARGS__)
87 #define LOG_WARNING(...) LOG(LOG_WARNING, __VA_ARGS__)
88 #define LOG_INFO(...) LOG(LOG_INFO, __VA_ARGS__)
89 #define LOG_DEBUG(...) LOG(LOG_DEBUG, __VA_ARGS__)
90 
92 #ifdef MODULE_LOG
93 #include "kubos-core/common/log_module.h"
94 #else
95 #include <stdio.h>
96 
100 #define log_write(level, ...) printf(__VA_ARGS__)
101 #endif
102 
103 #ifdef __cplusplus
104 }
105 #endif
106 
107 #endif /* LOG_H */
108 
Lowest log level, will output nothing.
Definition: k_log.h:56
#define LOG_WARNING(...)
Definition: k_log.h:87
#define LOG_ERROR(...)
logging convenience defines
Definition: k_log.h:86
#define LOG_INFO(...)
Definition: k_log.h:88
#define LOG_DEBUG(...)
Definition: k_log.h:89
print everything
Definition: k_log.h:67