mikroSDK Reference Manual
log.h
Go to the documentation of this file.
1/****************************************************************************
2**
3** Copyright (C) 2024 MikroElektronika d.o.o.
4** Contact: https://www.mikroe.com/contact
5**
6** This file is part of the mikroSDK package
7**
8** Commercial License Usage
9**
10** Licensees holding valid commercial NECTO compilers AI licenses may use this
11** file in accordance with the commercial license agreement provided with the
12** Software or, alternatively, in accordance with the terms contained in
13** a written agreement between you and The MikroElektronika Company.
14** For licensing terms and conditions see
15** https://www.mikroe.com/legal/software-license-agreement.
16** For further information use the contact form at
17** https://www.mikroe.com/contact.
18**
19**
20** GNU Lesser General Public License Usage
21**
22** Alternatively, this file may be used for
23** non-commercial projects under the terms of the GNU Lesser
24** General Public License version 3 as published by the Free Software
25** Foundation: https://www.gnu.org/licenses/lgpl-3.0.html.
26**
27** The above copyright notice and this permission notice shall be
28** included in all copies or substantial portions of the Software.
29**
30** THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
31** OF MERCHANTABILITY, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED
32** TO THE WARRANTIES FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
33** IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
34** DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT
35** OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE
36** OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
37**
38****************************************************************************/
39
43#ifndef _API_LOG_LOG_H_
44#define _API_LOG_LOG_H_
45
46#ifdef __cplusplus
47extern "C"{
48#endif
49
50#include "plot.h"
51
63typedef enum
64{
65 LOG_LEVEL_DEBUG = 0x00,
66 LOG_LEVEL_INFO = 0x01,
67 LOG_LEVEL_WARNING = 0x02,
68 LOG_LEVEL_ERROR = 0x03,
69 LOG_LEVEL_FATAL = 0x04
71
75typedef struct
76{
77 log_level_t log_level;
78} log_t;
79
83typedef struct
84{
85 log_level_t level;
86} log_cfg_t;
87
92#define LOG_MAP_USB_UART(cfg) cfg.level = LOG_LEVEL_DEBUG;
93
98#define LOG_MAP_MIKROBUS(cfg, mikrobus) cfg.level = LOG_LEVEL_DEBUG;
99
109void log_init ( log_t *log, log_cfg_t *cfg );
110
120void log_printf ( log_t *log, const code char * __generic_ptr f,... );
121
128void log_clear ( log_t *log );
129
136int8_t log_read ( log_t *log, uint8_t *rx_data_buf, uint8_t max_len );
137
148void log_info ( log_t *log, const code char * __generic_ptr f,... );
149
160void log_error ( log_t *log, const code char * __generic_ptr f,... );
161
172void log_fatal ( log_t *log, const code char * __generic_ptr f,... );
173
184void log_debug ( log_t *log, const code char * __generic_ptr f,... );
185
196void log_warning ( log_t *log, const code char * __generic_ptr f,... );
197
209void log_log ( log_t *log, char * prefix, const code char * __generic_ptr f, ... );
210
211 // loggroup
212 // apigroup
213
214#ifdef __cplusplus
215}
216#endif
217#endif // _API_LOG_LOG_H_
218// ------------------------------------------------------------------------- END
void log_warning(log_t *log, const code char *__generic_ptr f,...)
WARNING printf function.
void log_printf(log_t *log, const code char *__generic_ptr f,...)
Printf function.
void log_error(log_t *log, const code char *__generic_ptr f,...)
ERROR printf function.
void log_debug(log_t *log, const code char *__generic_ptr f,...)
DEBUG printf function.
void log_log(log_t *log, char *prefix, const code char *__generic_ptr f,...)
Printf function with a variable prefix.
void log_init(log_t *log, log_cfg_t *cfg)
Initializes LOG module.
log_level_t
Log level values.
Definition log.h:66
void log_info(log_t *log, const code char *__generic_ptr f,...)
INFO printf function.
void log_clear(log_t *log)
Empty wrapper API.
void log_fatal(log_t *log, const code char *__generic_ptr f,...)
FATAL printf function.
int8_t log_read(log_t *log, uint8_t *rx_data_buf, uint8_t max_len)
Empty wrapper API.
Implements plot functionality.
LOG init configuration structure.
Definition log.h:84
LOG context structure.
Definition log.h:76