Bluenet
5.7.0
Bluenet, firmware for nRF52 smart home devices
Loading...
Searching...
No Matches
cs_Logger.h
Go to the documentation of this file.
1
/*
2
* Author: Crownstone Team
3
* Copyright: Crownstone (https://crownstone.rocks)
4
* Date: Dec 9, 2020
5
* License: LGPLv3+, Apache License 2.0, and/or MIT (triple-licensed)
6
*/
7
8
#pragma once
9
10
#include <
cfg/cs_Strings.h
>
// Should actually be included by the files that use these.
11
#include <
protocol/cs_SerialTypes.h
>
12
#include <
protocol/cs_UartMsgTypes.h
>
13
14
#include <cstdint>
15
16
#if !defined HOST_TARGET && (CS_SERIAL_NRF_LOG_ENABLED > 0)
17
#include <
logging/impl/cs_LogNrf.h
>
18
19
#else
20
21
#if HOST_TARGET
22
#include <
logging/impl/cs_LogStdPrintf.h
>
23
24
#elif CS_UART_BINARY_PROTOCOL_ENABLED == 0
25
#include <
logging/impl/cs_LogPlainText.h
>
26
27
#elif SERIAL_VERBOSITY > SERIAL_BYTE_PROTOCOL_ONLY
28
#include <
logging/impl/cs_LogBinaryProtocol.h
>
29
30
#else
31
#include <
logging/impl/cs_LogNone.h
>
32
#endif
33
34
#endif
35
71
// Deprecated, use LOGvv instead. To disable particular logs, but without commenting it.
72
#define LOGnone(fmt, ...)
73
74
#if !defined HOST_TARGET && (CS_SERIAL_NRF_LOG_ENABLED > 0)
75
#define LOG_FLUSH NRF_LOG_FLUSH
76
77
#define LOGvv NRF_LOG_DEBUG
78
#define LOGv NRF_LOG_DEBUG
79
#define LOGd NRF_LOG_DEBUG
80
#define LOGi NRF_LOG_INFO
81
#define LOGw NRF_LOG_WARNING
82
#define LOGe NRF_LOG_ERROR
83
#define LOGf NRF_LOG_ERROR
84
85
#else
86
#define LOG_FLUSH()
87
88
#define LOGvv(fmt, ...) _log(SERIAL_VERY_VERBOSE, true, fmt, ##__VA_ARGS__)
89
#define LOGv(fmt, ...) _log(SERIAL_VERBOSE, true, fmt, ##__VA_ARGS__)
90
#define LOGd(fmt, ...) _log(SERIAL_DEBUG, true, fmt, ##__VA_ARGS__)
91
#define LOGi(fmt, ...) _log(SERIAL_INFO, true, fmt, ##__VA_ARGS__)
92
#define LOGw(fmt, ...) _log(SERIAL_WARN, true, fmt, ##__VA_ARGS__)
93
#define LOGe(fmt, ...) _log(SERIAL_ERROR, true, fmt, ##__VA_ARGS__)
94
#define LOGf(fmt, ...) _log(SERIAL_FATAL, true, fmt, ##__VA_ARGS__)
95
#endif
96
97
// undefine macros based on SERIAL_VERBOSITY
98
99
#if SERIAL_VERBOSITY < SERIAL_VERY_VERBOSE
100
#undef LOGvv
101
#define LOGvv(fmt, ...)
102
#endif
103
104
#if SERIAL_VERBOSITY < SERIAL_VERBOSE
105
#undef LOGv
106
#define LOGv(fmt, ...)
107
#endif
108
109
#if SERIAL_VERBOSITY < SERIAL_DEBUG
110
#undef LOGd
111
#define LOGd(fmt, ...)
112
#endif
113
114
#if SERIAL_VERBOSITY < SERIAL_INFO
115
#undef LOGi
116
#define LOGi(fmt, ...)
117
#endif
118
119
#if SERIAL_VERBOSITY < SERIAL_WARN
120
#undef LOGw
121
#define LOGw(fmt, ...)
122
#endif
123
124
#if SERIAL_VERBOSITY < SERIAL_ERROR
125
#undef LOGe
126
#define LOGe(fmt, ...)
127
#endif
128
129
#if SERIAL_VERBOSITY < SERIAL_FATAL
130
#undef LOGf
131
#define LOGf(fmt, ...)
132
#endif
cs_LogBinaryProtocol.h
cs_LogNone.h
cs_LogNrf.h
cs_LogPlainText.h
cs_LogStdPrintf.h
cs_SerialTypes.h
cs_Strings.h
cs_UartMsgTypes.h
source
include
logging
cs_Logger.h
Generated by
1.9.5