-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathlogger.h
48 lines (39 loc) · 1.2 KB
/
logger.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
#ifndef __LOGGER__H
#define __LOGGER__H
#include <stdio.h>
#include <stdarg.h>
#include <stdlib.h>
#include <stdint.h>
#include <time.h>
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <stdint.h>
#include <stdarg.h>
#define DEBUGGER
typedef enum
{
ASSERT = 0,
ERROR = 1,
WARNING = 2,
INFO = 3,
DEBUG = 4,
}logLevel_t;
/**
* @brief Set Debug Level
* @param [in] LOG_LEVEL ( ASSERT-ERROR-WARNING-INFO-DEBUG )
*/
void setLogLevel(logLevel_t logLevel);
#define debugAssert(...) debug_printf(ASSERT ,__FUNCTION__,__FILE__,__LINE__,__VA_ARGS__)
#define debugError(...) debug_printf(ERROR ,__FUNCTION__,__FILE__,__LINE__,__VA_ARGS__)
#define debugWarning(...) debug_printf(WARNING,__FUNCTION__,__FILE__,__LINE__,__VA_ARGS__)
#define debugInfo(...) debug_printf(INFO ,__FUNCTION__,__FILE__,__LINE__,__VA_ARGS__)
#define debugf(...) debug_printf(DEBUG ,__FUNCTION__,__FILE__,__LINE__,__VA_ARGS__)
/**
* @brief Logger by stdout
* @param [in] selectLogLevel Log Level
* @param [in] format Printf Format
* @param ... Argumans
*/
int debug_printf(logLevel_t logLevel,const char* function, const char* file, const int line, const char *format,...);
#endif