Max OS 0.3
Loading...
Searching...
No Matches
logger.h File Reference

Defines a Logger class for logging messages with different severity levels to multiple output streams. More...

#include <common/outputStream.h>
#include <common/colour.h>
#include <common/spinlock.h>

Go to the source code of this file.

Classes

class  MaxOS::Logger
 A class that handles logging messages to the console and files. More...
 

Macros

#define ASSERT(condition, format, ...)   Logger::ASSERT(condition, format, ##__VA_ARGS__)
 If the specified condition is not met then the kernel will crash with the specified message.
 

Enumerations

enum class  MaxOS::LogLevel {
  ERROR , WARNING , HEADER , INFO ,
  TEST , DEBUG
}
 Priority levels for logging messages. Different levels may be used to filter messages based on their importance depending on build type. More...
 

Variables

constexpr uint8_t MaxOS::MAX_LOG_WRITERS = 5
 The maximum number of log writers that can be added to the logger.
 
constexpr LogLevel MaxOS::MAX_LOG_LEVEL = LogLevel::DEBUG
 The maximum log level for this build (messages above this level will not be logged)
 

Detailed Description

Defines a Logger class for logging messages with different severity levels to multiple output streams.

Date
4th April 2025
Author
Max Tyson

Definition in file logger.h.

Macro Definition Documentation

◆ ASSERT

#define ASSERT (   condition,
  format,
  ... 
)    Logger::ASSERT(condition, format, ##__VA_ARGS__)

If the specified condition is not met then the kernel will crash with the specified message.

This macro wraps Logger::ASSERT and supports printf-style formatting with variadic arguments.

Parameters
conditionThe condition to check.
formatThe format string (like printf).
...Additional arguments to format.
See also
Logger::ASSERT

Definition at line 100 of file logger.h.

Enumeration Type Documentation

◆ LogLevel

enum class MaxOS::LogLevel
strong

Priority levels for logging messages. Different levels may be used to filter messages based on their importance depending on build type.

Definition at line 23 of file logger.h.

23 {
24 ERROR,
25 WARNING,
26 HEADER,
27 INFO,
28 TEST,
29 DEBUG,
30 };

Variable Documentation

◆ MAX_LOG_LEVEL

constexpr LogLevel MaxOS::MAX_LOG_LEVEL = LogLevel::DEBUG
constexpr

The maximum log level for this build (messages above this level will not be logged)

Definition at line 37 of file logger.h.

Referenced by MaxOS::Logger::write_char().

◆ MAX_LOG_WRITERS

constexpr uint8_t MaxOS::MAX_LOG_WRITERS = 5
constexpr

The maximum number of log writers that can be added to the logger.

Definition at line 33 of file logger.h.

Referenced by MaxOS::Logger::add_log_writer().