Logging supports severity levels above info via the legacy LogPrintf. So use the more appropriate LogError or LogWarning, where it applies.
This has a few small benefits:
- It often allows to remove the manual and literal “error: “, “Warning:”, … prefixes. Instead the uniform log level formatting is used.
- It is easier to grep or glance for more severe logs, which indicate some kind of alert.
LogPrintfdidn’t indicate any severity level, but it is an alias forLogInfo. So having the log level explicitly spelled out makes it easier to read the code.- Also, remove the redundant trailing
\nnewline, while touching. - Also, remove the
__func__formatting in the log string, which is redundant with-logsourcelocations. Instead, use a unique log string for each location.