odygrd / quill

Asynchronous Low Latency C++ Logging Library
MIT License
1.36k stars 142 forks source link

ConsoleHandler: fix for out of bounds array access with dynamic log level and coloured console output #421

Closed usefulcat closed 3 months ago

usefulcat commented 4 months ago

When using a dynamic log level, ConsoleHandler::write() needs to get the log level by calling TransitEvent::log_level() instead of directly accessing the log level stored in MacroMetaData.

MacroMetadata::_log_level could be LogLevel::Dynamic, which will result in an out of bounds array access in ConsoleColours::colour_code().

Prior to this change, ConsoleHandler::write() was apparently not using the correct colour value for a dynamic log level (unless by accident).

odygrd commented 3 months ago

thanks for the PR : )