Tiny protocol
0.9.0
Tiny communication protocol for microcontrollers
src
proto
hal
tiny_debug.h
1
/*
2
Copyright 2019 (C) Alexey Dynda
3
4
This file is part of Tiny Protocol Library.
5
6
Protocol Library is free software: you can redistribute it and/or modify
7
it under the terms of the GNU Lesser General Public License as published by
8
the Free Software Foundation, either version 3 of the License, or
9
(at your option) any later version.
10
11
Protocol Library is distributed in the hope that it will be useful,
12
but WITHOUT ANY WARRANTY; without even the implied warranty of
13
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14
GNU Lesser General Public License for more details.
15
16
You should have received a copy of the GNU Lesser General Public License
17
along with Protocol Library. If not, see <http://www.gnu.org/licenses/>.
18
*/
19
20
#pragma once
21
22
#ifndef DOXYGEN_SHOULD_SKIP_THIS
23
24
#ifdef __cplusplus
25
extern
"C"
{
26
#endif
27
28
#include <stdio.h>
29
#include <inttypes.h>
30
31
#ifndef TINY_LOG_LEVEL_DEFAULT
32
#define TINY_LOG_LEVEL_DEFAULT 0
33
#endif
34
35
extern
uint8_t g_tiny_log_level;
36
37
enum
38
{
39
TINY_LOG_CRIT = 0,
40
TINY_LOG_ERR = 1,
41
TINY_LOG_WRN = 2,
42
TINY_LOG_INFO = 3,
43
TINY_LOG_DEB = 4,
44
};
45
46
#ifndef TINY_DEBUG
47
#define TINY_DEBUG 1
48
#endif
49
50
#if TINY_DEBUG
51
#define TINY_LOG(lvl, fmt, ...) { if (lvl < g_tiny_log_level) fprintf(stderr, "%08"PRIu32" ms: "fmt, tiny_millis(), ##__VA_ARGS__); }
52
#else
53
#define TINY_LOG(...)
54
#endif
55
56
#ifdef __cplusplus
57
}
58
#endif
59
60
#endif
Generated by
1.8.13