summaryrefslogtreecommitdiff
path: root/include/boltdbg/util/logger.h
blob: 554f2c793921459026a3fdb12453be03cbede3ad (plain)
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
#ifndef BOLTDBG_UTIL_LOGGER_H_
#define BOLTDBG_UTIL_LOGGER_H_

/*
 * Global spdlog accessor for boltdbg.
 *
 * Use Log::get() anywhere to obtain the shared logger.
 */

#include <memory>
#include <spdlog/spdlog.h>

namespace Log { // NOTE: capital 'L' to avoid collision with C math 'log'
    // Return a reference to a shared_ptr logger initialized on first use.
    std::shared_ptr<spdlog::logger>& get();
}

// Handy logger macros (use Log with capital L)
#define LOG_TRACE(...)    ::Log::get()->trace(__VA_ARGS__)
#define LOG_DEBUG(...)    ::Log::get()->debug(__VA_ARGS__)
#define LOG_INFO(...)     ::Log::get()->info(__VA_ARGS__)
#define LOG_WARN(...)     ::Log::get()->warn(__VA_ARGS__)
#define LOG_ERROR(...)    ::Log::get()->error(__VA_ARGS__)
#define LOG_CRITICAL(...) ::Log::get()->critical(__VA_ARGS__)

#endif // BOLTDBG_UTIL_LOGGER_H_