|
|
|
@ -73,13 +73,12 @@
|
|
|
|
|
#define SPDLITE_CRITICAL(...) (void)0
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
namespace spdlog {
|
|
|
|
|
class logger;
|
|
|
|
|
|
|
|
|
|
namespace lite {
|
|
|
|
|
enum class level{
|
|
|
|
|
enum class level
|
|
|
|
|
{
|
|
|
|
|
trace = SPDLITE_LEVEL_TRACE,
|
|
|
|
|
debug = SPDLITE_LEVEL_DEBUG,
|
|
|
|
|
info = SPDLITE_LEVEL_INFO,
|
|
|
|
@ -89,13 +88,15 @@ namespace spdlog {
|
|
|
|
|
off = SPDLITE_LEVEL_OFF
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
struct src_loc {
|
|
|
|
|
struct src_loc
|
|
|
|
|
{
|
|
|
|
|
const char *filename;
|
|
|
|
|
int line;
|
|
|
|
|
const char *funcname;
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
class logger {
|
|
|
|
|
class logger
|
|
|
|
|
{
|
|
|
|
|
public:
|
|
|
|
|
logger() = default;
|
|
|
|
|
|
|
|
|
@ -109,8 +110,10 @@ namespace spdlog {
|
|
|
|
|
bool should_log(spdlog::lite::level lvl) const noexcept;
|
|
|
|
|
|
|
|
|
|
template<typename... Args>
|
|
|
|
|
void log(spdlog::lite::level lvl, const char *fmt, const Args &... args) {
|
|
|
|
|
if (!should_log(lvl)) {
|
|
|
|
|
void log(spdlog::lite::level lvl, const char *fmt, const Args &... args)
|
|
|
|
|
{
|
|
|
|
|
if (!should_log(lvl))
|
|
|
|
|
{
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
fmt::memory_buffer formatted_buf;
|
|
|
|
@ -118,10 +121,11 @@ namespace spdlog {
|
|
|
|
|
log_formatted_(lvl, formatted_buf);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
template<typename... Args>
|
|
|
|
|
void log(const spdlog::lite::src_loc& src, spdlog::lite::level lvl, const char *fmt, const Args &... args) {
|
|
|
|
|
if (!should_log(lvl)) {
|
|
|
|
|
void log(const spdlog::lite::src_loc &src, spdlog::lite::level lvl, const char *fmt, const Args &... args)
|
|
|
|
|
{
|
|
|
|
|
if (!should_log(lvl))
|
|
|
|
|
{
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
fmt::memory_buffer formatted_buf;
|
|
|
|
@ -129,7 +133,6 @@ namespace spdlog {
|
|
|
|
|
log_formatted_src(src, lvl, formatted_buf);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
template<typename... Args>
|
|
|
|
|
void trace(const char *fmt, const Args &... args)
|
|
|
|
|
{
|
|
|
|
@ -191,11 +194,9 @@ namespace spdlog {
|
|
|
|
|
std::shared_ptr<spdlog::logger> impl_;
|
|
|
|
|
void log_formatted_(spdlog::lite::level lvl, const fmt::memory_buffer &formatted);
|
|
|
|
|
void log_formatted_src(const spdlog::lite::src_loc &src, spdlog::lite::level lvl, const fmt::memory_buffer &formatted);
|
|
|
|
|
|
|
|
|
|
};
|
|
|
|
|
spdlog::lite::logger &default_logger();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
template<typename... Args>
|
|
|
|
|
void trace(const char *fmt, const Args &... args)
|
|
|
|
|
{
|
|
|
|
@ -231,7 +232,6 @@ namespace spdlog {
|
|
|
|
|
default_logger().critical(fmt, args...);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
} // namespace lite
|
|
|
|
|
|
|
|
|
|
// factory to create lite logger
|
|
|
|
|