14#include <lagrange/Logger.h>
15#include <lagrange/ui/Entity.h>
21template <
typename...
Args>
24 spdlog::level::level_enum level,
25 const std::string_view& fmt,
30 std::unordered_set<std::string> messages;
32 auto& msgs = r.ctx().emplace<LogOnceCache>().messages;
33 if (msgs.count(fmt.data()))
return;
34 logger().log(level, fmt, std::forward<Args>(args)...);
35 msgs.insert(fmt.data());
39template <
typename...
Args>
40void log_trace_once(ui::Registry& r,
const std::string_view& fmt,
Args&&... args)
42 log_once(r, spdlog::level::trace, fmt, std::forward<Args>(args)...);
45template <
typename...
Args>
46void log_debug_once(ui::Registry& r,
const std::string_view& fmt,
Args&&... args)
48 log_once(r, spdlog::level::debug, fmt, std::forward<Args>(args)...);
51template <
typename...
Args>
52void log_info_once(ui::Registry& r,
const std::string_view& fmt,
Args&&... args)
54 log_once(r, spdlog::level::info, fmt, std::forward<Args>(args)...);
57template <
typename...
Args>
58void log_warn_once(ui::Registry& r,
const std::string_view& fmt,
Args&&... args)
60 log_once(r, spdlog::level::warn, fmt, std::forward<Args>(args)...);
63template <
typename...
Args>
64void log_error_once(ui::Registry& r,
const std::string_view& fmt,
Args&&... args)
66 log_once(r, spdlog::level::err, fmt, std::forward<Args>(args)...);
69template <
typename...
Args>
70void log_critical_once(ui::Registry& r,
const std::string_view& fmt,
Args&&... args)
72 log_once(r, spdlog::level::critical, fmt, std::forward<Args>(args)...);
LA_CORE_API spdlog::logger & logger()
Retrieves the current logger.
Definition: Logger.cpp:40
Lagrange UI Viewer and mini 3D engine.
Definition: AcceleratedPicking.h:22
void log_once(ui::Registry &r, spdlog::level::level_enum level, const std::string_view &fmt, Args &&... args)
Log message once per registry lifetime.
Definition: logger.h:22
Main namespace for Lagrange.
Definition: AABBIGL.h:30
Definition: project.cpp:27