Log: remove the obsolete printf-style functions

This commit is contained in:
Max Kellermann
2021-10-13 16:08:48 +02:00
parent 2fbbd540bb
commit 72f6e018e7
17 changed files with 102 additions and 283 deletions

View File

@@ -25,6 +25,7 @@
#include "config/Block.hxx"
#include "Log.hxx"
#include "PluginUnavailable.hxx"
#include "util/Domain.hxx"
#include "util/RuntimeError.hxx"
#include <cassert>
@@ -35,6 +36,8 @@
#include "plugins/UringInputPlugin.hxx"
#endif
static constexpr Domain input_domain("input");
void
input_stream_global_init(const ConfigData &config, EventLoop &event_loop)
{
@@ -67,14 +70,14 @@ input_stream_global_init(const ConfigData &config, EventLoop &event_loop)
plugin->init(event_loop, *block);
input_plugins_enabled[i] = true;
} catch (const PluginUnconfigured &e) {
LogFormat(LogLevel::DEBUG, e,
"Input plugin '%s' is not configured",
plugin->name);
FmtDebug(input_domain,
"Input plugin '{}' is not configured: %s",
plugin->name, e.what());
continue;
} catch (const PluginUnavailable &e) {
FormatError(e,
"Input plugin '%s' is unavailable",
plugin->name);
FmtDebug(input_domain,
"Input plugin '{}' is unavailable: %s",
plugin->name, e.what());
continue;
} catch (...) {
std::throw_with_nested(FormatRuntimeError("Failed to initialize input plugin '%s'",

View File

@@ -24,8 +24,13 @@
#include "../InputStream.hxx"
#include "fs/LookupFile.hxx"
#include "fs/Path.hxx"
#include "lib/fmt/ExceptionFormatter.hxx"
#include "lib/fmt/PathFormatter.hxx"
#include "util/Domain.hxx"
#include "Log.hxx"
static constexpr Domain input_domain("input");
InputStreamPtr
OpenArchiveInputStream(Path path, Mutex &mutex)
{
@@ -38,8 +43,9 @@ OpenArchiveInputStream(Path path, Mutex &mutex)
return nullptr;
}
} catch (...) {
LogFormat(LogLevel::DEBUG, std::current_exception(),
"not an archive, lookup %s failed", path.c_str());
FmtDebug(input_domain,
"not an archive, lookup '{}' failed: {}",
path, std::current_exception());
return nullptr;
}