Switch log types to enum
This commit is contained in:
parent
24b2be60e5
commit
4c14c3dc57
27 changed files with 203 additions and 105 deletions
|
|
@ -24,11 +24,20 @@
|
|||
class Logger {
|
||||
public:
|
||||
static Logger& get();
|
||||
void add_log(const std::string& log, const std::function<void(const std::string&)> callback);
|
||||
void log(const std::string& log, const std::string& text);
|
||||
enum class LogType {
|
||||
INFO = 0,
|
||||
DESKTOP_USERINFO,
|
||||
PHONE_USERINFO,
|
||||
USERINFO,
|
||||
WORLDFATAL,
|
||||
CHAT,
|
||||
FATAL
|
||||
};
|
||||
void set_log_function(LogType log, const std::function<void(const std::string&)> callback);
|
||||
void log(LogType log, const std::string& text);
|
||||
void cross_platform_println(const std::string& text);
|
||||
private:
|
||||
static Logger global;
|
||||
std::mutex logMutex;
|
||||
std::unordered_map<std::string, std::function<void(const std::string&)>> logs;
|
||||
std::unordered_map<LogType, std::function<void(const std::string&)>> logs;
|
||||
};
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue