The Logger module provides thread-safe logging utilities for applications.
Features:
Thread-safe logging
Multiple log levels: TRACE, DEBUG, INFO, WARN, ERROR, FATAL, PANIC, NOTICE
Supports both API calls and macros
Can log to console, files, or custom destinations
C API Logging
#include "Capi/au/logger/logger.h"
logger_ctx_t* logger = au_logger_create();
au_logger_log(logger, "Hello From Logger", AUD_LOG_LEVEL_INFO);
au_logger_log(logger, "Error occurred", AUD_LOG_LEVEL_ERROR);
au_logger_flush(logger);
au_logger_destroy(logger);
C Logging Macros
#include "Capi/au/logger/macros.h"
AUD_LOG_INFO("This is info message");
AUD_LOG_ERROR("This is error message");
AUD_LOG_WARN("This is warn message");
C++ API Logging
#include "Au/Logger/LogManager.hh"
#include "Au/Logger/Macros.hh"
auto consoleLogger = LoggerFactory::createLogger("ConsoleLogger", "Main");
LogWriter::setLogger(std::move(consoleLogger));
auto logWriter = LogWriter::getLogWriter();
LogManager logger(logWriter);
Message msg("This is a message");
logger.log(msg);
logger << "Using operator<<";
logger.flush();
C++ Logging Macros
AU_LOGGER_LOG_INFO("Info message");
AU_LOGGER_LOG_WARN("Warning message");
AU_LOGGER_LOG_ERROR("Error message");
AU_LOGGER_LOG_DEBUG("Debug message");
Log Levels (in order of severity):
TRACE: Detailed execution traces
DEBUG: Debug information
INFO: Informational messages
NOTICE: Normal but significant events
WARN: Warning messages
ERROR: Error conditions
FATAL: Fatal errors
PANIC: System panic (highest severity)
Using Logger for Diagnostics:
Enable DEBUG or TRACE level for troubleshooting
Use INFO level for production
ERROR/FATAL for critical issues
Thread-safe: can be used from multiple threads
Performance Considerations:
Asynchronous logging minimizes overhead
Flush periodically (not on every message)
Disable verbose logging in production for best performance
Best Practices:
Create logger once at startup
Use appropriate log levels (don’t spam INFO with DEBUG messages)
Flush before application exit
Clean up logger resources (
au_logger_destroyin C)