first commit
This commit is contained in:
commit
7349b743e3
21 files changed
+1527
No files matched your search
@@ -0,0 +1,19 @@
|
||||
#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_;
|
||||
};
|
||||
Reference in new issue
Block a user