kopia lustrzana https://github.com/stlink-org/stlink
Added interface for spdlog (optional)
rodzic
e7f41b2965
commit
45c31e9169
|
@ -8,10 +8,16 @@
|
|||
#ifndef LOGGING_H
|
||||
#define LOGGING_H
|
||||
|
||||
#include <stdint.h>
|
||||
#include "spdlog_wrapper.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif // __cplusplus
|
||||
|
||||
/* Optional: Enable interface for SPDLOG to replace UglyLogging */
|
||||
// #define SPDLOG_LOGGING
|
||||
|
||||
enum ugly_loglevel {
|
||||
UDEBUG = 90,
|
||||
UINFO = 50,
|
||||
|
@ -44,6 +50,17 @@ int32_t ugly_libusb_log_level(enum ugly_loglevel v);
|
|||
#define ELOG_HELPER(format, ...) ugly_log(UERROR, UGLY_LOG_FILE, format, __VA_ARGS__)
|
||||
#define ELOG(...) ugly_log(UERROR, UGLY_LOG_FILE, __VA_ARGS__)
|
||||
|
||||
#if defined(SPDLOG_LOGGING)
|
||||
#undef DLOG_HELPER
|
||||
#undef ILOG_HELPER
|
||||
#undef WLOG_HELPER
|
||||
#undef ELOG_HELPER
|
||||
#define DLOG(...) spdlogLog(UDEBUG, __VA_ARGS__)
|
||||
#define ILOG(...) spdlogLog(UINFO, __VA_ARGS__)
|
||||
#define WLOG(...) spdlogLog(UWARN, __VA_ARGS__)
|
||||
#define ELOG(...) spdlogLog(UERROR, __VA_ARGS__)
|
||||
#endif // SPDLOG_LOGGING
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif // __cplusplus
|
||||
|
|
|
@ -0,0 +1,14 @@
|
|||
#ifndef _SPDLOG_WRAPPER_
|
||||
#define _SPDLOG_WRAPPER_
|
||||
|
||||
#ifdef __cplusplus
|
||||
#define EXTERNC extern "C"
|
||||
#else
|
||||
#define EXTERNC
|
||||
#endif
|
||||
|
||||
EXTERNC int spdlogLog(int level, const char *str, ...);
|
||||
|
||||
#undef EXTERNC
|
||||
|
||||
#endif
|
Ładowanie…
Reference in New Issue