-
Notifications
You must be signed in to change notification settings - Fork 37
/
spdlogwrapper.hpp
30 lines (26 loc) · 1.02 KB
/
spdlogwrapper.hpp
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
#ifndef SPDLOGWRAPPER_HPP
#define SPDLOGWRAPPER_HPP
#include "spdlog/spdlog.h"
namespace spdlog
{
void spdlog_init(const char* name, const char* file_name, int h, int m, int lv, int flv);
logger* logger_ptr();
} // spdlog
#ifdef USE_SPDLOG_
#define L_TRACE(fmt, ...) spdlog::logger_ptr()->trace(fmt, ##__VA_ARGS__);
#define L_DEBUG(fmt, ...) spdlog::logger_ptr()->debug(fmt, ##__VA_ARGS__);
#define L_INFO(fmt, ...) spdlog::logger_ptr()->info(fmt, ##__VA_ARGS__);
#define L_WARN(fmt, ...) spdlog::logger_ptr()->warn(fmt, ##__VA_ARGS__);
#define L_ERROR(fmt, ...) spdlog::logger_ptr()->error(fmt, ##__VA_ARGS__);
#define L_CRITICAL(fmt, ...) spdlog::logger_ptr()->critical(fmt, ##__VA_ARGS__);
#define L_FUNCTION() L_TRACE("function: {0} @ line: {1}", __FUNCTION__, __LINE__);
#else
#define L_TRACE(fmt, ...)
#define L_DEBUG(fmt, ...)
#define L_INFO(fmt, ...)
#define L_WARN(fmt, ...)
#define L_ERROR(fmt, ...)
#define L_CRITICAL(fmt, ...)
#define L_FUNCTION()
#endif // USE_SPDLOG_
#endif // SPDLOGWRAPPER_HPP