Files
sniper/include/Logger.hpp
T
2026-08-09 16:51:01 -05:00

20 lines
585 B
C++

#pragma once
#include <string>
#include <functional>
enum class LogTag { Info, Ok, Warn, Err };
// Thread-safe console logger (stand-in for the python `push_log` + log_queue/SSE).
// Also supports a "sink" callback so the Discord bot can mirror log lines into
// a Discord channel/log command without polling a queue.
class Logger {
public:
using Sink = std::function<void(const std::string& ts, const std::string& msg, LogTag tag)>;
static void log(const std::string& msg, LogTag tag = LogTag::Info);
static void setSink(Sink sink);
private:
static Sink sink_;
};