OGS
Logging.h
Go to the documentation of this file.
1 
12 #pragma once
13 
14 #include <spdlog/logger.h>
15 
16 #include <memory>
17 #include <string>
18 
19 #include "baselib_export.h"
20 
21 namespace BaseLib
22 {
23 extern BASELIB_EXPORT std::shared_ptr<spdlog::logger> console;
24 void setConsoleLogLevel(std::string const& level_string);
25 void initOGSLogger(std::string const& log_level);
26 } // namespace BaseLib
27 
28 template <typename... Args>
29 void DBUG(fmt::format_string<Args...> fmt, Args&&... args)
30 {
31  BaseLib::console->debug(fmt, std::forward<Args>(args)...);
32 }
33 template <typename... Args>
34 void INFO(fmt::format_string<Args...> fmt, Args&&... args)
35 {
36  BaseLib::console->info(fmt, std::forward<Args>(args)...);
37 }
38 template <typename... Args>
39 void WARN(fmt::format_string<Args...> fmt, Args&&... args)
40 {
41  BaseLib::console->warn(fmt, std::forward<Args>(args)...);
42 }
43 template <typename... Args>
44 void ERR(fmt::format_string<Args...> fmt, Args&&... args)
45 {
46  BaseLib::console->error(fmt, std::forward<Args>(args)...);
47 }
48 template <typename... Args>
49 void CRITICAL(fmt::format_string<Args...> fmt, Args&&... args)
50 {
51  BaseLib::console->critical(fmt, std::forward<Args>(args)...);
52 }
void INFO(fmt::format_string< Args... > fmt, Args &&... args)
Definition: Logging.h:34
void DBUG(fmt::format_string< Args... > fmt, Args &&... args)
Definition: Logging.h:29
void ERR(fmt::format_string< Args... > fmt, Args &&... args)
Definition: Logging.h:44
void WARN(fmt::format_string< Args... > fmt, Args &&... args)
Definition: Logging.h:39
void CRITICAL(fmt::format_string< Args... > fmt, Args &&... args)
Definition: Logging.h:49
#define BASELIB_EXPORT
void initOGSLogger(std::string const &log_level)
Definition: Logging.cpp:52
void setConsoleLogLevel(std::string const &level_string)
Definition: Logging.cpp:35
std::shared_ptr< spdlog::logger > console
Definition: Logging.cpp:30