CANdevStudio
Development tool for CAN bus simulation
Loading...
Searching...
No Matches
log.h
Go to the documentation of this file.
1#include <cstring>
2#include <iostream>
3#include <memory>
4
5#include <spdlog/fmt/fmt.h>
6#include <spdlog/sinks/stdout_color_sinks.h>
7#include <spdlog/spdlog.h>
8
9extern std::shared_ptr<spdlog::logger> kDefaultLogger;
10
11#define __FILENAME__ (std::strrchr(__FILE__, '/') ? strrchr(__FILE__, '/') + 1 : __FILE__)
12
13#define cds_debug(fmt, ...) \
14 do { \
15 kDefaultLogger->debug("[{}():{}@{}] " fmt, __FUNCTION__, __FILENAME__, __LINE__, ##__VA_ARGS__); \
16 } while (0)
17#define cds_warn(fmt, ...) \
18 do { \
19 kDefaultLogger->warn("[{}():{}@{}] " fmt, __FUNCTION__, __FILENAME__, __LINE__, ##__VA_ARGS__); \
20 } while (0)
21#define cds_error(fmt, ...) \
22 do { \
23 kDefaultLogger->error("[{}():{}@{}] " fmt, __FUNCTION__, __FILENAME__, __LINE__, ##__VA_ARGS__); \
24 } while (0)
25#define cds_info(fmt, ...) \
26 do { \
27 kDefaultLogger->info("[{}():{}@{}] " fmt, __FUNCTION__, __FILENAME__, __LINE__, ##__VA_ARGS__); \
28 } while (0)
std::shared_ptr< spdlog::logger > kDefaultLogger
Definition common_test.cpp:27