BastionGuard/thirdparty/bastionguard-secure-connection/daemon/include/bsc/logging/Logger.hpp
specialworld83 f0f913a209 Release 2.0
2026-07-15 10:52:22 +02:00

33 lines
826 B
C++

#pragma once
#include <mutex>
#include <string>
namespace bsc::logging {
enum class Level { Debug = 0, Info = 1, Warning = 2, Error = 3 };
class Logger {
public:
static Logger& instance();
void set_level(Level level);
void set_utc(bool enabled);
void set_microseconds(bool enabled);
void set_log_file(const std::string& path);
void debug(const std::string& msg);
void info(const std::string& msg);
void warning(const std::string& msg);
void error(const std::string& msg);
private:
void log(Level level, const std::string& msg);
std::string timestamp() const;
std::string level_name(Level level) const;
Level level_{Level::Info};
bool utc_{true};
bool micro_{false};
std::string file_path_;
mutable std::mutex mutex_;
};
} // namespace bsc::logging