perf(log): return early from WriteToFile for filtered messages
WriteToFile() called localtime(), strftime(), std::replace() and built
several std::string copies before checking whether the message passes
the log file level. Debug messages are logged at many places in the flow
(PSRAM allocations, CNN steps, ...), and with the default log level all
of that work was thrown away.
Return at the top when the message would be dropped by both the log
file (level > loglevel) and the console (level > esp_log_level_get(tag)).
Measured on an ESP32-CAM with LogLevel = 3 (INFO): 230 filtered debug
messages per round cost 81 ms before and 9 ms after. With the default
LogLevel = 1 more messages are filtered, so the saving is larger.
Console and file output are unchanged: ESP_LOG_LEVEL() applies the same
esp_log_level_get(tag) filter internally.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>