-
Notifications
You must be signed in to change notification settings - Fork 27
/
Copy pathlogger.h
50 lines (39 loc) · 1.7 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
49
50
#ifndef NDNDPDK_CORE_LOGGER_H
#define NDNDPDK_CORE_LOGGER_H
/** @file */
#include "common.h"
#undef RTE_LOG_DP_LEVEL
#ifdef N_LOG_LEVEL
#define RTE_LOG_DP_LEVEL N_LOG_LEVEL
#else
#define RTE_LOG_DP_LEVEL RTE_LOG_DEBUG
#endif
#define N_LOG_INIT(module) \
static int RTE_LOGTYPE_NDN = -1; \
RTE_INIT(Logger_Init_##module) { \
RTE_LOGTYPE_NDN = rte_log_register_type_and_pick_level("NDN." #module, RTE_LOG_INFO); \
} \
struct AllowTrailingSemicolon_
#define N_LOG(lvl, fmt, ...) RTE_LOG_DP(lvl, NDN, fmt "\n", ##__VA_ARGS__)
#define N_LOGV(...) N_LOG(DEBUG, __VA_ARGS__)
#define N_LOGD(...) N_LOG(INFO, __VA_ARGS__)
#define N_LOGI(...) N_LOG(NOTICE, __VA_ARGS__)
#define N_LOGW(...) N_LOG(WARNING, __VA_ARGS__)
#define N_LOGE(...) N_LOG(ERR, __VA_ARGS__)
#define N_LOG_ERROR(s) " ERROR={" s "}"
#define N_LOG_ERROR_BLANK N_LOG_ERROR("-")
#define N_LOG_ERROR_ERRNO N_LOG_ERROR("errno<%d>")
#define N_LOG_ERROR_STR N_LOG_ERROR("%s")
__attribute__((nonnull)) int
Logger_Dpdk_Init(FILE* output);
__attribute__((nonnull)) void
Logger_Spdk(int level, const char* restrict file, const int line, const char* restrict func,
const char* restrict format, va_list args);
/**
* @brief Print buffer in hexadecimal to stderr.
*
* This is only used during debugging, and should not appear in committed code.
*/
__attribute__((nonnull)) void
Logger_HexDump(const uint8_t* b, size_t count);
#endif // NDNDPDK_CORE_LOGGER_H