re: #30347 (review)
I don’t think it makes sense for us to have 7 levels of logging – even 5 is a lot. Renaming Warning to Critical and Error to Fatal for the reasons given seems fine, but the old names shouldn’t be kept around in that case.
I think the reality is we already have 7 levels of logging, but we are using 5 names to describe them. This PR is a small fix to make the names used in the code match the intent of the code.
For example, the documentation says LogError
should only be used to log fatal errors. But currently it is being used to log both fatal errors and nonfatal errors. If you would like to log errors less, or at lower priority, I would enthusiastically agree with that goal. But I don’t think those changes should be folded into this PR, which is minimal and not trying to fix problems that are broader and more complicated than simple bad naming.
Your flowchart is a good idealization, but it does not describe the realities of current code, which is using logging for ordinary error reporting, not just the most critical errors. A description of the actual log levels in our code base is:
Fatal
messages indicate severe problems (e.g. data loss) that will trigger shutdowns
Critical
messages indicate severe problems (e.g. incorrect system time, internal bug detected) that users should address in some way
Error
messages indicate less severe problems (e.g. loss of connectivity) that the users should probably know about, but might be transient
Warning
messages indicate unexpected conditions (e.g. user specified -checkblocks
number higher than number of blocks that may be available to check) that the user should know about, and indicate potential problems
For completeness, Info
messages provide information about normal activity, Debug
messages can help users troubleshoot issues, and Trace
is mostly unused but geared more towards developers.
Overall, I agree with the direction you want to take in reducing number of log levels, and I would applaud any effort to reduce amount of log spam and report errors by other means, but I don’t think those goals should get in the way of fixing names that are confusing and misleading to developers.
If you want to open a PR that takes a broader approach and also fixes the bad names, I will happily go along with it and close this PR. But I think reasonable to want to take one step at at time here and just fix the bad naming.