Partition, ...: use libfmt for logging

This commit is contained in:
Max Kellermann
2021-06-24 20:22:48 +02:00
parent 0185d58a2b
commit 6f539cfcd6
44 changed files with 320 additions and 296 deletions

View File

@@ -22,6 +22,8 @@
#include "Filtered.hxx"
#include "Client.hxx"
#include "Domain.hxx"
#include "lib/fmt/AudioFormatFormatter.hxx"
#include "lib/fmt/ExceptionFormatter.hxx"
#include "thread/Util.hxx"
#include "thread/Slack.hxx"
#include "thread/Name.hxx"
@@ -166,10 +168,8 @@ AudioOutputControl::InternalOpen(const AudioFormat in_audio_format,
}
if (f != in_audio_format || f != output->out_audio_format)
FormatDebug(output_domain, "converting in=%s -> f=%s -> out=%s",
ToString(in_audio_format).c_str(),
ToString(f).c_str(),
ToString(output->out_audio_format).c_str());
FmtDebug(output_domain, "converting in={} -> f={} -> out={}",
in_audio_format, f, output->out_audio_format);
}
inline void
@@ -231,8 +231,9 @@ AudioOutputControl::FillSourceOrClose() noexcept
try {
return source.Fill(mutex);
} catch (...) {
FormatError(std::current_exception(),
"Failed to filter for %s", GetLogName());
FmtError(output_domain,
"Failed to filter for {}: {}",
GetLogName(), std::current_exception());
InternalCloseError(std::current_exception());
return false;
}
@@ -250,9 +251,9 @@ AudioOutputControl::PlayChunk(std::unique_lock<Mutex> &lock) noexcept
caught_interrupted = true;
return false;
} catch (...) {
FormatError(std::current_exception(),
"Failed to send tag to %s",
GetLogName());
FmtError(output_domain,
"Failed to send tag to {}: {}",
GetLogName(), std::current_exception());
}
}
@@ -277,8 +278,9 @@ AudioOutputControl::PlayChunk(std::unique_lock<Mutex> &lock) noexcept
caught_interrupted = true;
return false;
} catch (...) {
FormatError(std::current_exception(),
"Failed to play on %s", GetLogName());
FmtError(output_domain,
"Failed to play on {}",
GetLogName(), std::current_exception());
InternalCloseError(std::current_exception());
return false;
}
@@ -356,9 +358,9 @@ AudioOutputControl::InternalPause(std::unique_lock<Mutex> &lock) noexcept
success = output->IteratePause();
} catch (AudioOutputInterrupted) {
} catch (...) {
FormatError(std::current_exception(),
"Failed to pause %s",
GetLogName());
FmtError(output_domain,
"Failed to pause {}: {}",
GetLogName(), std::current_exception());
}
if (!success) {
@@ -416,8 +418,9 @@ AudioOutputControl::InternalDrain() noexcept
output->Drain();
} catch (...) {
FormatError(std::current_exception(),
"Failed to flush filter on %s", GetLogName());
FmtError(output_domain,
"Failed to flush filter on {}: {}",
GetLogName(), std::current_exception());
InternalCloseError(std::current_exception());
return;
}