Wildmeshing Toolkit
Logger.hpp
Go to the documentation of this file.
1 #pragma once
2 
3 // clang-format off
4 #include <fmt/ranges.h>
5 #include <spdlog/spdlog.h>
6 // clang-format on
7 
8 namespace wmtk {
9 
17 
24 
31 void set_logger(std::shared_ptr<spdlog::logger> logger);
32 
39 void set_opt_logger(std::shared_ptr<spdlog::logger> logger);
40 
41 [[noreturn]] void log_and_throw_error(const std::string& msg);
42 
43 template <typename... Args>
44 [[noreturn]] void log_and_throw_error(const std::string& msg, const Args&... args)
45 {
46  log_and_throw_error(fmt::format(fmt::runtime(msg), args...));
47 }
48 } // namespace wmtk
Definition: Accessor.hpp:6
void set_opt_logger(std::shared_ptr< spdlog::logger > x)
Setup a logger object to be used by WildmeshToolkit optimization.
Definition: Logger.cpp:96
bool has_user_overloaded_logger_level()
Definition: Logger.cpp:9
void set_logger(std::shared_ptr< spdlog::logger > x)
Setup a logger object to be used by WildmeshToolkit.
Definition: Logger.cpp:90
void log_and_throw_error(const std::string &msg)
Definition: Logger.cpp:101
spdlog::logger & logger()
Retrieves the current logger.
Definition: Logger.cpp:58
spdlog::logger & opt_logger()
Retrieves the logger for the optimization.
Definition: Logger.cpp:75