hydrobricks
Loading...
Searching...
No Matches
Log.h
1#ifndef HYDROBRICKS_LOG_H
2#define HYDROBRICKS_LOG_H
3
4#include <format>
5#include <string>
6
7enum class LogLevel {
8 Error,
9 Warning,
10 Message,
11 Debug
12};
13
18void LogSetLevel(LogLevel level);
19
23void LogSetFile(const std::string& path);
24
28void LogFlush();
29
30// Core logging functions (non-template)
31void LogError(const std::string& msg);
32void LogWarning(const std::string& msg);
33void LogMessage(const std::string& msg);
34void LogDebug(const std::string& msg);
35
36// Template overloads for formatted messages (std::format style)
37template <typename... Args>
38void LogError(std::format_string<Args...> fmt, Args&&... args) {
39 LogError(std::format(fmt, std::forward<Args>(args)...));
40}
41
42template <typename... Args>
43void LogWarning(std::format_string<Args...> fmt, Args&&... args) {
44 LogWarning(std::format(fmt, std::forward<Args>(args)...));
45}
46
47template <typename... Args>
48void LogMessage(std::format_string<Args...> fmt, Args&&... args) {
49 LogMessage(std::format(fmt, std::forward<Args>(args)...));
50}
51
52template <typename... Args>
53void LogDebug(std::format_string<Args...> fmt, Args&&... args) {
54 LogDebug(std::format(fmt, std::forward<Args>(args)...));
55}
56
57#endif // HYDROBRICKS_LOG_H