3#include <spdlog/sinks/stdout_color_sinks.h>
12 std::shared_ptr<spdlog::logger> &get_shared_logger()
14 static std::shared_ptr<spdlog::logger>
logger;
19 std::shared_ptr<spdlog::logger> &get_shared_adjoint_logger()
21 static std::shared_ptr<spdlog::logger>
logger;
30 if (get_shared_adjoint_logger())
32 return *get_shared_adjoint_logger();
36 static std::shared_ptr<spdlog::logger> default_logger = spdlog::stdout_color_mt(
"adjoint-polyfem");
37 return *default_logger;
44 if (get_shared_logger())
46 return *get_shared_logger();
54 static std::shared_ptr<spdlog::logger> default_logger = spdlog::stdout_color_mt(
"polyfem");
55 return *default_logger;
60 void set_logger(std::shared_ptr<spdlog::logger> p_logger)
62 get_shared_logger() = std::move(p_logger);
68 get_shared_adjoint_logger() = std::move(p_logger);
74 throw std::runtime_error(msg);
80 throw std::runtime_error(msg);
spdlog::logger & logger()
Retrieves the current logger.
spdlog::logger & adjoint_logger()
Retrieves the current logger for adjoint.
void set_adjoint_logger(std::shared_ptr< spdlog::logger > p_logger)
Setup a logger object to be used by adjoint Polyfem.
void log_and_throw_adjoint_error(const std::string &msg)
void set_logger(std::shared_ptr< spdlog::logger > p_logger)
Setup a logger object to be used by Polyfem.
void log_and_throw_error(const std::string &msg)