Prompt
Always use the project’s standard logging system (mbgl::Log) with appropriate log levels instead of ad-hoc solutions like std::cout, printf, or custom logging macros. This ensures consistent log formatting, proper filtering, and integration with test frameworks.
Key guidelines:
- Use mbgl::Log with the appropriate event type and level:
// Instead of: // std::cout << "-------- HASTILE - FOUND IN TILES\n"; // or: #if MLN_PLUGIN_LAYER_LOGGING_ENABLED std::cout << "Working on: " << name << "\n"; #endif // Use: Log::Debug(Event::General, "HASTILE - FOUND IN TILES"); // or for errors: Log::Error(Event::OpenGL, "Failed to open X display, retrying..."); - Choose the correct log level based on message importance:
- Debug: Detailed information useful during development
- Info: General operational messages
- Warning: Concerning but non-fatal issues
- Error: Serious problems that need attention
- Add logging for error conditions and edge cases to improve visibility:
if (!checkAndSetMode(Mode::Primitives)) { Log::Warning(Event::Render, "Cannot add triangle with current mode"); return; } - Remove commented-out debug prints from production code or convert them to proper logging calls.
Be mindful that log levels can affect test behavior - some test fixtures may filter specific log levels.