8 #include "hazelcast/util/export.h"
10 #if defined(WIN32) || defined(_WIN32) || defined(WIN64) || defined(_WIN64)
12 #pragma warning(disable : 4251)
15 #ifndef HZ_LOGGING_DISABLED
16 #define HZ_LOG(lg, lvl, msg) \
17 if ((lg).enabled(::hazelcast::logger::level::lvl)) { \
18 (lg).log(::hazelcast::logger::level::lvl, (msg)); \
21 #define HZ_LOG(lg, lvl, msg)
34 using handler_type = std::function<
35 void(
const std::string&,
const std::string&, level,
const std::string&)>;
37 logger(std::string instance_name,
38 std::string cluster_name,
40 handler_type handler);
42 bool enabled(level lvl) noexcept;
44 void log(level lvl,
const std::string& msg) noexcept;
46 static void default_handler(
const std::string& instance_name,
47 const std::string& cluster_name,
49 const std::string& msg) noexcept;
52 const std::string instance_name_;
53 const std::string cluster_name_;
55 const handler_type handler_;
56 static std::mutex cout_lock_;
59 enum class logger::level : int
61 all = (std::numeric_limits<int>::min)(),
68 off = (std::numeric_limits<int>::max)()
71 HAZELCAST_API std::ostream&
72 operator<<(std::ostream&, logger::level level);
76 #if defined(WIN32) || defined(_WIN32) || defined(WIN64) || defined(_WIN64)