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