9#ifndef MAXOS_COMMON_LOGGER_H
10#define MAXOS_COMMON_LOGGER_H
48 uint8_t m_log_writer_count = 0;
50 bool m_log_writers_enabled[
MAX_LOG_WRITERS] = {
false,
false,
false,
false,
false };
53 static inline uint8_t s_progress_total = 100;
54 uint8_t m_progress_current = 0;
56 static inline Logger* s_active_logger =
nullptr;
58 LogLevel m_log_level = LogLevel::INFO;
70 void printf(
const char* format, ...);
72 static void ASSERT(
bool condition,
const char* message, ...);
85 using OutputStream::operator <<;
100#define ASSERT(condition, format, ...) Logger::ASSERT(condition, format, ##__VA_ARGS__)
A class that handles logging messages to the console and files.
static Logger TEST()
Gets active logger set to test level.
static Logger DEBUG()
Gets active logger set to DEBUG level.
static Logger & Out()
Gets the active logger.
void printf(const char *format,...)
Prints a formatted string to the logger.
static Logger * active_logger()
Gets the active logger (to be used to modify the logger)
void disable_log_writer(OutputStream *log_writer)
Removes an output stream from the logger.
static Logger WARNING()
Gets active logger set to WARNING level.
void add_log_writer(OutputStream *log_writer)
Adds an output stream to the logger.
static Logger INFO()
Gets active logger set to info level.
void write_char(char c) final
Writes a character to the logger.
static Logger ERROR()
Gets active logger set to ERROR level.
Logger()
Constructs a Logger object and sets it as the active logger.
void set_log_level(LogLevel log_level)
Sets the log level of the logger.
static Logger HEADER()
Gets active logger set to task level.
Logger & operator<<(LogLevel log_level)
Sets the log level of the logger.
A stream that strings can be written to.
OutputStream()
Constructs an OutputStream object that uses strings as the underlying data type.
Defines a Colour class for representing colours in RGBA format, along with ANSI and console colour en...
LogLevel
Priority levels for logging messages. Different levels may be used to filter messages based on their ...
constexpr LogLevel MAX_LOG_LEVEL
The maximum log level for this build (messages above this level will not be logged)
#define ASSERT(condition, format,...)
If the specified condition is not met then the kernel will crash with the specified message.
constexpr uint8_t MAX_LOG_WRITERS
The maximum number of log writers that can be added to the logger.
Defines OutputStream and GenericOutputStream classes for writing data to streams.
Defines Spinlock and BlockingLock classes for thread synchronization.