AVRly - AVR Development Resources
log_system.h
Go to the documentation of this file.
1/******************************************************************************
2 @copyright Copyright © 2022 by Jason Duffy.
3
4 Permission is hereby granted, free of charge, to any person obtaining a copy
5 of this software and associated documentation files (the "Software"), to deal
6 in the Software without restriction, including without limitation the rights
7 to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
8 copies of the Software, and to permit persons to whom the Software is
9 furnished to do so, subject to the following conditions:
10
11 The above copyright notice and this permission notice shall be included in all
12 copies or substantial portions of the Software.
13
14 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15 IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16 FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17 AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18 LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
19 OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
20 SOFTWARE.
21******************************************************************************/
22
23/**
24 * @file log_system.h
25 * @ingroup ccs811
26 * @author Jason Duffy
27 * @date 15th March 2022
28 * @brief Driver file providing logging functionality over USART, to print
29 * debug messages and values to a teminal program on your PC.
30 * @bug No known bugs.
31 * @see
32 */
33
34#ifndef LOG_SYSTEM_DOT_H
35#define LOG_SYSTEM_DOT_H
36
37enum eLogLevel {NONE, INFO, DEBUG, VERBOSE_DEBUG, WARNING, ERROR};
38
39// Initialisation routine
40void init_log_system(void);
41
42// Sends only a string message
43void log_message(const char *p_tag, enum eLogLevel level, const char *msg);
44
45// Sends a string, followed by a value in decimal format
46void log_message_with_dec_val(const char *p_tag, enum eLogLevel level, const char *msg, uint8_t val);
47
48void log_message_with_16bit_dec_val(const char *p_tag, enum eLogLevel level, const char *msg, uint16_t val);
49
50// Sends a string, followed by a value in binary format
51void log_message_with_bin_val(const char *p_tag, enum eLogLevel level, const char *msg, uint8_t val);
52
53// Sends a string, followed by a value in hexadecimal format
54void log_message_with_hex_val(const char *p_tag, enum eLogLevel level, const char *msg, uint8_t val);
55
56// Sets level of logging required
57void log_set_output_level(const char *p_tag, enum eLogLevel level);
58
59// Turns logging system on globally
60void log_global_on(void);
61
62// Turns logging system off globally
63void log_global_off(void);
64
65#endif // LOG_SYSTEM_DOT_H
66
67/*** end of file ***/
void log_message_with_dec_val(log_system_config_t *p_config, log_type_t level, const char *msg, uint8_t val)
Sends a string, followed by an 8 bit value in decimal format.
Definition: log_system.c:116
void log_global_on(void)
Turns logging system on globally.
Definition: log_system.c:133
void init_log_system(void)
Initialisation routine - call this function once at startup before using other functions.
Definition: log_system.c:46
void log_message_with_hex_val(log_system_config_t *p_config, log_type_t level, const char *msg, uint8_t val)
Sends a string, followed by an 8 bit value in hexadecimal format.
Definition: log_system.c:193
void log_global_off(void)
Turns logging system off globally.
Definition: log_system.c:139
void log_message(log_system_config_t *p_config, log_type_t level, const char *msg)
Sends only the system tag, log level and message string.
Definition: log_system.c:93
void log_message_with_bin_val(log_system_config_t *p_config, log_type_t level, const char *msg, uint8_t val)
Sends a string, followed by an 8 bit value in binary format.
Definition: log_system.c:167