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 {
69 };
70 
71 #ifndef LOG_LEVEL
72 
75 #define LOG_LEVEL LOG_INFO
76 #endif
77 
81 #define LOG(level, ...) if (level <= LOG_LEVEL) log_write(level, __VA_ARGS__)
82 
87 #define LOG_ERROR(...) LOG(LOG_ERROR, __VA_ARGS__)
88 #define LOG_WARNING(...) LOG(LOG_WARNING, __VA_ARGS__)
89 #define LOG_TELEMETRY(...) LOG(LOG_TELEMETRY, __VA_ARGS__)
90 #define LOG_INFO(...) LOG(LOG_INFO, __VA_ARGS__)
91 #define LOG_DEBUG(...) LOG(LOG_DEBUG, __VA_ARGS__)
92 
94 #ifdef MODULE_LOG
95 #include "kubos-core/common/log_module.h"
96 #else
97 #include <stdio.h>
98 
102 #define log_write(level, ...) printf(__VA_ARGS__)
103 #endif
104 
105 #ifdef __cplusplus
106 }
107 #endif
108 
109 #endif /* LOG_H */
110 
Lowest log level, will output nothing.
Definition: k_log.h:56
#define LOG_WARNING(...)
Definition: k_log.h:88
#define LOG_ERROR(...)
logging convenience defines
Definition: k_log.h:87
#define LOG_INFO(...)
Definition: k_log.h:90
#define LOG_DEBUG(...)
Definition: k_log.h:91
#define LOG_TELEMETRY(...)
Definition: k_log.h:89
print everything
Definition: k_log.h:68