jay/component/logger.h

36 lines
754 B
C++

// SPDX-FileCopyrightText: 2024 Yury Gubich <blue@macaw.me>
// SPDX-License-Identifier: GPL-3.0-or-later
#pragma once
#include <vector>
#include <gloox/loghandler.h>
#include <gloox/logsink.h>
class Logger: public gloox::LogHandler {
public:
enum Level {
trace,
debug,
info,
warning,
error,
fatal
};
public:
Logger(Level level = info);
~Logger();
void handleLog(gloox::LogLevel level, gloox::LogArea area, const std::string& message) override;
void log(Level level, const std::string& message, const std::vector<std::string>& domain = {}) const;
static gloox::LogLevel convert(Level level);
static Level convert(gloox::LogLevel level);
private:
Level level;
};