32 #include <spdlog/logger.h> 33 #include <spdlog/spdlog.h> 35 #include <pdi/pdi_fwd.h> 36 #include <pdi/paraconf_wrapper.h> 44 std::shared_ptr<spdlog::logger> m_logger;
47 std::vector<std::reference_wrapper<Logger>> m_default_pattern_observers;
50 std::string m_pattern =
"[%T][%n] *** %^%l%$: %v";
53 bool m_pattern_from_config =
false;
64 Logger(
const std::string& logger_name, PC_tree_t config, spdlog::level::level_enum level = spdlog::level::info);
71 Logger(
Logger& parent_logger,
const std::string& logger_name, PC_tree_t config);
78 void setup(
const std::string& logger_name, PC_tree_t config, spdlog::level::level_enum level = spdlog::level::info);
85 void setup(
Logger& parent_logger,
const std::string& logger_name, PC_tree_t config);
91 void pattern(
const std::string& pattern);
98 void default_pattern(
const std::string& pattern);
103 const std::string& pattern()
const;
108 void level(spdlog::level::level_enum log_level);
113 spdlog::level::level_enum level()
const;
119 void evaluate_pattern(
Context& ctx)
const;
125 template<
typename... Args>
126 void trace(
const char* fmt, Args&& ... args)
128 m_logger->trace(fmt, std::forward<Args>(args)...);
135 template<
typename... Args>
136 void debug(
const char* fmt, Args&& ... args)
138 m_logger->debug(fmt, std::forward<Args>(args)...);
145 template<
typename... Args>
146 void info(
const char* fmt, Args&& ... args)
148 m_logger->info(fmt, std::forward<Args>(args)...);
155 template<
typename... Args>
156 void warn(
const char* fmt, Args&& ... args)
158 m_logger->warn(fmt, std::forward<Args>(args)...);
165 template<
typename... Args>
166 void error(
const char* fmt, Args&& ... args)
168 m_logger->error(fmt, std::forward<Args>(args)...);
174 std::shared_ptr<spdlog::logger> real_logger();
180 #endif // PDI_LOGGER_H_
Wrapper for spdlog::logger with additional pattern getter method.
Definition: logger.h:41
void info(const char *fmt, Args &&... args)
Writes info level message.
Definition: logger.h:146
void error(const char *fmt, Args &&... args)
Writes error level message.
Definition: logger.h:166
void debug(const char *fmt, Args &&... args)
Writes debug level message.
Definition: logger.h:136
Definition: array_datatype.h:37
void warn(const char *fmt, Args &&... args)
Writes warning level message.
Definition: logger.h:156
void trace(const char *fmt, Args &&... args)
Writes trace level message.
Definition: logger.h:126