hyprcursor/libhyprcursor/Log.hpp

22 lines
494 B
C++
Raw Permalink Normal View History

2024-03-07 04:19:38 +01:00
#pragma once
#include <string>
#include <format>
#include <iostream>
2024-03-24 21:37:31 +01:00
#include <hyprcursor/shared.h>
2024-03-07 04:19:38 +01:00
namespace Debug {
inline bool quiet = false;
inline bool verbose = false;
template <typename... Args>
2024-03-24 21:37:31 +01:00
void log(eHyprcursorLogLevel level, PHYPRCURSORLOGFUNC fn, const std::string& fmt, Args&&... args) {
if (!fn)
2024-03-07 04:19:38 +01:00
return;
2024-03-24 21:37:31 +01:00
const std::string LOG = std::vformat(fmt, std::make_format_args(args...));
2024-03-07 04:19:38 +01:00
2024-03-24 21:37:31 +01:00
fn(level, (char*)LOG.c_str());
2024-03-07 04:19:38 +01:00
}
};