SHA256
Compare commits
3
Commits
| Author | SHA256 | Date | |
|---|---|---|---|
|
|
7eb3331d8e | ||
|
|
b4ed8d601d | ||
|
|
e99541c139 |
@@ -2,16 +2,14 @@
|
|||||||
#define FEATHERLOG_LOG_FORMATTER_HPP
|
#define FEATHERLOG_LOG_FORMATTER_HPP
|
||||||
|
|
||||||
#include <string>
|
#include <string>
|
||||||
|
#include <featherlog/flog_definitions.h>
|
||||||
|
|
||||||
#include
|
namespace flog {
|
||||||
|
class FLOG_API LogFormatter {
|
||||||
namespace flog
|
|
||||||
{
|
|
||||||
class LogFormatter
|
|
||||||
{
|
|
||||||
public:
|
public:
|
||||||
virtual ~LogFormatter() = default;
|
virtual ~LogFormatter() = default;
|
||||||
virtual std::string format() = 0;
|
|
||||||
|
virtual std::string FLOG_CALL format() = 0;
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -3,10 +3,9 @@
|
|||||||
|
|
||||||
#include <cstdint>
|
#include <cstdint>
|
||||||
|
|
||||||
namespace flog
|
namespace flog {
|
||||||
{
|
using LogLevelType = uint8_t;
|
||||||
enum class LogLevel : uint8_t
|
enum class LogLevel : LogLevelType {
|
||||||
{
|
|
||||||
TRACE = 0,
|
TRACE = 0,
|
||||||
DEBUG = 1,
|
DEBUG = 1,
|
||||||
INFO = 2,
|
INFO = 2,
|
||||||
@@ -14,7 +13,7 @@ namespace flog
|
|||||||
ERROR = 4,
|
ERROR = 4,
|
||||||
FATAL = 5,
|
FATAL = 5,
|
||||||
|
|
||||||
OFF = 0xff,
|
OFF = std::numeric_limits<LogLevelType>::max()
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -8,43 +8,39 @@
|
|||||||
#include <unordered_map>
|
#include <unordered_map>
|
||||||
#include <vector>
|
#include <vector>
|
||||||
|
|
||||||
#include "logger.hpp"
|
#include <featherlog/logger.hpp>
|
||||||
#include "log_formatter.hpp"
|
#include <featherlog/log_level.hpp>
|
||||||
#include "log_level.hpp"
|
#include <featherlog/log_message.hpp>
|
||||||
#include "log_message.hpp"
|
#include <featherlog/log_outputter.hpp>
|
||||||
#include "log_outputter.hpp"
|
#include <featherlog/flog_definitions.h>
|
||||||
|
|
||||||
namespace flog
|
namespace flog {
|
||||||
{
|
class FLOG_API LogManager : public std::enable_shared_from_this<LogManager> {
|
||||||
class LogManager;
|
|
||||||
|
|
||||||
class LogManager : public std::enable_shared_from_this<LogManager>
|
|
||||||
{
|
|
||||||
friend class LoggerCallback;
|
friend class LoggerCallback;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
LogManager(const LogManager&) = delete;
|
LogManager(const LogManager &) = delete;
|
||||||
LogManager& operator=(const LogManager&) = delete;
|
LogManager &operator=(const LogManager &) = delete;
|
||||||
LogManager(LogManager&&) = delete;
|
LogManager(LogManager &&) = delete;
|
||||||
LogManager& operator=(LogManager&&) = delete;
|
LogManager &operator=(LogManager &&) = delete;
|
||||||
|
|
||||||
static std::shared_ptr<LogManager> create();
|
static std::shared_ptr<LogManager> FLOG_CALL create();
|
||||||
|
|
||||||
~LogManager();
|
~LogManager();
|
||||||
|
|
||||||
LogLevel get_min_log_level() const noexcept;
|
LogLevel FLOG_CALL get_min_log_level() const noexcept;
|
||||||
void set_min_log_level(LogLevel level) noexcept;
|
void FLOG_CALL set_min_log_level(LogLevel level) noexcept;
|
||||||
|
|
||||||
void add_outputter(std::unique_ptr<LogOutputter> outputter);
|
void FLOG_CALL add_outputter(std::unique_ptr<LogOutputter> outputter);
|
||||||
|
|
||||||
std::shared_ptr<Logger> get_logger(const std::string& name);
|
std::shared_ptr<Logger> FLOG_CALL get_logger(const std::string &name);
|
||||||
|
|
||||||
size_t clean_unused_loggers();
|
size_t FLOG_CALL clean_unused_loggers();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
LogManager() noexcept = default;
|
LogManager() noexcept = default;
|
||||||
|
|
||||||
void print_log(const LogMessage& message) const;
|
void FLOG_CALL print_log(const LogMessage &message) const;
|
||||||
|
|
||||||
std::atomic<LogLevel> m_minLogLevel{LogLevel::DEBUG};
|
std::atomic<LogLevel> m_minLogLevel{LogLevel::DEBUG};
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user