When I tried to add cool new clang-tidy 14 warnings, I noticed that the
current clang-tidy settings already produce a ton of warnings. This
commit addresses many of these. Almost all of them were non-critical,
i.e. C vs. C++ style casts.
- Move some code into module part to avoid dependency from IStorage in SystemLog
- Remove extra headers from SystemLog.h
- Rewrite some code that was relying on headers that was included by SystemLog.h
v2: rebase
v3: squash move into module part with explicit template instantiation
(to make each commit self compilable after rebase)
Some code does not expect from the logger code to throw, and this can
lead to the problems like:
- marking distributed batch as broken (in
StorageDistributedDirectoryMonitor)
- some MergeTree code may also be affected.
So instead of throwing the exception, it will be logged to the stderr
(if it is possible).