198 std::unique_ptr<BaseLogger> backend)
noexcept;
249 void Error(
const char* tag,
const char* format, ...)
noexcept;
257 void Warn(
const char* tag,
const char* format, ...)
noexcept;
265 void Info(
const char* tag,
const char* format, ...)
noexcept;
273 void Debug(
const char* tag,
const char* format, ...)
noexcept;
281 void Verbose(
const char* tag,
const char* format, ...)
noexcept;
347 void LogAsciiArt(
const char* tag,
const char* ascii_art,
366 void LogBanner(
const char* tag,
const char* ascii_art,
409 void Flush()
noexcept;
475 const
char* format, va_list args) noexcept;
505 const
char* ascii_art,
539#define LOG_ERROR(tag, ...) Logger::GetInstance().Error(tag, __VA_ARGS__)
540#define LOG_WARN(tag, ...) Logger::GetInstance().Warn(tag, __VA_ARGS__)
541#define LOG_INFO(tag, ...) Logger::GetInstance().Info(tag, __VA_ARGS__)
542#define LOG_DEBUG(tag, ...) Logger::GetInstance().Debug(tag, __VA_ARGS__)
543#define LOG_VERBOSE(tag, ...) Logger::GetInstance().Verbose(tag, __VA_ARGS__)
545#define LOG_ERROR_FORMATTED(tag, color, style, ...) Logger::GetInstance().Error(tag, color, style, __VA_ARGS__)
546#define LOG_WARN_FORMATTED(tag, color, style, ...) Logger::GetInstance().Warn(tag, color, style, __VA_ARGS__)
547#define LOG_INFO_FORMATTED(tag, color, style, ...) Logger::GetInstance().Info(tag, color, style, __VA_ARGS__)
548#define LOG_DEBUG_FORMATTED(tag, color, style, ...) Logger::GetInstance().Debug(tag, color, style, __VA_ARGS__)
549#define LOG_VERBOSE_FORMATTED(tag, color, style, ...) Logger::GetInstance().Verbose(tag, color, style, __VA_ARGS__)
551#define LOG_ASCII_ART(tag, art, format) Logger::GetInstance().LogAsciiArt(tag, art, format)
552#define LOG_BANNER(tag, art, format) Logger::GetInstance().LogBanner(tag, art, format)
LogLevel
Log levels.
Definition Logger.h:85
LogBackground
Background colors (ANSI color codes)
Definition Logger.h:62
@ DEFAULT
Default background.
LogColor
Text colors (ANSI color codes)
Definition Logger.h:39
@ BRIGHT_YELLOW
Bright yellow.
@ BRIGHT_WHITE
Bright white.
@ BRIGHT_GREEN
Bright green.
@ BRIGHT_CYAN
Bright cyan.
@ BRIGHT_BLACK
Bright black.
@ BRIGHT_MAGENTA
Bright magenta.
@ BRIGHT_BLUE
Bright blue.
LogStyle
Text formatting styles.
Definition Logger.h:27
@ UNDERLINE
Underlined text.
@ DOUBLE_UNDERLINE
Double underlined text.
@ STRIKETHROUGH
Strikethrough text.
Advanced logging system with formatting capabilities.
Definition Logger.h:158
void SetLogLevel(const char *tag, LogLevel level) noexcept
Set log level for a tag.
Definition Logger.cpp:160
LogConfig config_
Definition Logger.h:417
static std::unique_ptr< BaseLogger > CreateDefaultBaseLogger() noexcept
Resolve the platform-default BaseLogger.
Definition EspLoggerFactory.cpp:43
void EnableColors(bool enable) noexcept
Enable/disable colors.
Definition Logger.cpp:404
static constexpr size_t kMaxTagLevels
Fixed-size tag-level storage (avoids std::map heap allocation)
Definition Logger.h:420
void EnableEffects(bool enable) noexcept
Enable/disable effects.
Definition Logger.cpp:414
void LogBanner(const char *tag, const char *ascii_art, const AsciiArtFormat &format=AsciiArtFormat{}) noexcept
Log ASCII art banner.
Definition Logger.cpp:358
LogConfig GetConfig() const noexcept
Get current configuration.
Definition Logger.cpp:400
void Flush() noexcept
Flush any buffered output.
Definition Logger.cpp:428
static constexpr size_t kMaxTagLength
Definition Logger.h:421
void Info(const char *tag, const char *format,...) noexcept
Log info message.
Definition Logger.cpp:244
size_t WriteColorPrefix(char *buf, size_t buf_size, LogColor color, LogBackground background, LogStyle style) const noexcept
Write ANSI color/style prefix into a buffer.
Definition Logger.cpp:468
static Logger & GetInstance() noexcept
Get singleton instance.
Definition Logger.cpp:91
std::atomic< bool > initialized_
Definition Logger.h:416
void Deinitialize() noexcept
Deinitialize the logger.
Definition Logger.cpp:137
void LogInternal(LogLevel level, const char *tag, LogColor color, LogStyle style, const char *format, va_list args) noexcept
Internal logging method.
Definition Logger.cpp:438
std::unique_ptr< BaseLogger > base_logger_
Definition Logger.h:429
static size_t WriteResetSequence(char *buf, size_t buf_size) noexcept
Write ANSI reset sequence into a buffer.
Definition Logger.cpp:501
void FormatAndLogAsciiArt(const char *tag, LogLevel level, const char *ascii_art, const AsciiArtFormat &format) noexcept
Format and log ASCII art line-by-line without heap allocation.
Definition Logger.cpp:512
void LogAsciiArt(const char *tag, const char *ascii_art, const AsciiArtFormat &format=AsciiArtFormat{}) noexcept
Log ASCII art.
Definition Logger.cpp:340
TagLevel tag_levels_[kMaxTagLevels]
Definition Logger.h:427
void Warn(const char *tag, const char *format,...) noexcept
Log warning message.
Definition Logger.cpp:233
void EnableAsciiArt(bool enable) noexcept
Enable/disable ASCII art support.
Definition Logger.cpp:424
bool IsInitialized() const noexcept
Check if logger is initialized.
Definition Logger.cpp:152
void Debug(const char *tag, const char *format,...) noexcept
Log debug message.
Definition Logger.cpp:255
void SetConfig(const LogConfig &config) noexcept
Set default configuration.
Definition Logger.cpp:388
void Verbose(const char *tag, const char *format,...) noexcept
Log verbose message.
Definition Logger.cpp:266
bool Initialize(const LogConfig &config=LogConfig{}) noexcept
Initialize the logger using the platform-default BaseLogger backend (resolved via the MCU-specific lo...
Definition Logger.cpp:100
void Error(const char *tag, const char *format,...) noexcept
Log error message.
Definition Logger.cpp:222
void DumpStatistics() const noexcept
Dump comprehensive logger statistics to log as INFO level. Logs internal logger statistics,...
Definition Logger.cpp:646
LogLevel GetLogLevel(const char *tag) const noexcept
Get log level for a tag.
Definition Logger.cpp:193
Logger() noexcept
Constructor.
Definition Logger.cpp:61
bool IsLevelEnabled(LogLevel level, const char *tag) const noexcept
Check if log level is enabled for tag.
Definition Logger.cpp:629
void SetTagLevel(const char *tag, LogLevel level) noexcept
Set the minimum visible log level for messages emitted with a specific tag (e.g. throttle a noisy HAL...
Definition Logger.cpp:211
Logging configuration.
Definition Logger.h:96
uint32_t max_width
Maximum output width.
Definition Logger.h:103
uint32_t border_padding
Border padding.
Definition Logger.h:107
LogLevel level
Default log level.
Definition Logger.h:97
bool enable_colors
Enable ANSI colors.
Definition Logger.h:101
LogBackground background
Default background.
Definition Logger.h:99
bool enable_ascii_art
Enable ASCII art support.
Definition Logger.h:108
LogColor color
Default text color.
Definition Logger.h:98
char border_char
Border character.
Definition Logger.h:106
bool format_ascii_art
Apply formatting to ASCII art.
Definition Logger.h:109
bool center_text
Center the text.
Definition Logger.h:104
bool add_border
Add border around text.
Definition Logger.h:105
bool enable_effects
Enable special effects.
Definition Logger.h:102
LogStyle style
Default text style.
Definition Logger.h:100
char tag[kMaxTagLength]
Definition Logger.h:423
bool in_use
Definition Logger.h:425
LogLevel level
Definition Logger.h:424