Route all logging through the Void::Log facade
Delete the echoion Logger adapter (Logger.{hpp,cpp}) and the
ILogger/LoggerRegistry indirection. Core::installLogging() builds the
console + split-file Void::Logging::MultiLogger and installs it as the
process-wide Void::Log sink via Void::Log::make_sink (logSink_ owns it for
the process lifetime). The ~450 ECHOION_LOG_* call sites across EchoionCore
are rewritten to Void::Log::<level>("<Subsystem>", "{}", <expr>) with
per-file module tags (warning->warn, critical->fatal); the pre-formatted
message is passed as the single "{}" argument. Build green.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
1 parent
0e08ccaefa
commit
2d7651c308
42 files changed
+550
-792
No files matched your search
+15
-15
@@ -1,4 +1,4 @@
|
||||
#include "LoggerInterface.hpp"
|
||||
#include <Void/Log/Log.hpp>
|
||||
#include "echoion/core/AudioDecoder.hpp"
|
||||
extern "C" {
|
||||
#include <libavcodec/avcodec.h>
|
||||
@@ -41,7 +41,7 @@ namespace Echoion::Core
|
||||
if (hwConfig.isEnabled()) {
|
||||
auto result = initializeHardwareAccel(hwConfig);
|
||||
if (!result) {
|
||||
ECHOION_LOG_WARNING(
|
||||
Void::Log::warn("AudioDecoder", "{}",
|
||||
std::format("Hardware acceleration init failed: {}, "
|
||||
"falling back to software",
|
||||
result.error().message));
|
||||
@@ -49,7 +49,7 @@ namespace Echoion::Core
|
||||
}
|
||||
av_log_set_level(AV_LOG_DEBUG);
|
||||
initialized_ = true;
|
||||
ECHOION_LOG_INFO("AudioDecoder initialized");
|
||||
Void::Log::info("AudioDecoder", "{}", "AudioDecoder initialized");
|
||||
return {};
|
||||
}
|
||||
|
||||
@@ -87,7 +87,7 @@ namespace Echoion::Core
|
||||
}
|
||||
|
||||
hwAccelType_ = config.type;
|
||||
ECHOION_LOG_INFO(std::format("Hardware acceleration configured: {}",
|
||||
Void::Log::info("AudioDecoder", "{}", std::format("Hardware acceleration configured: {}",
|
||||
av_hwdevice_get_type_name(hwType)));
|
||||
|
||||
return {};
|
||||
@@ -180,12 +180,12 @@ namespace Echoion::Core
|
||||
}
|
||||
|
||||
av_dict_set(&options, "proxy", proxyUrl.c_str(), 0);
|
||||
ECHOION_LOG_INFO(std::format("Using proxy for ffmpeg: {}:{}",
|
||||
Void::Log::info("AudioDecoder", "{}", std::format("Using proxy for ffmpeg: {}:{}",
|
||||
proxyConfig_->host,
|
||||
proxyConfig_->port));
|
||||
}
|
||||
|
||||
ECHOION_LOG_DEBUG(
|
||||
Void::Log::debug("AudioDecoder", "{}",
|
||||
std::format("Opening audio source: {}", url.substr(0, 80)));
|
||||
|
||||
// Allocate format context first (needed for interrupt callback)
|
||||
@@ -214,7 +214,7 @@ namespace Echoion::Core
|
||||
if (ret < 0) {
|
||||
char errbuf[256];
|
||||
av_strerror(ret, errbuf, sizeof(errbuf));
|
||||
ECHOION_LOG_ERROR(std::format(
|
||||
Void::Log::error("AudioDecoder", "{}", std::format(
|
||||
"FFmpeg failed to open input (error {}): {}", ret, errbuf));
|
||||
return Api::fail(
|
||||
Api::ErrorCode::AudioError,
|
||||
@@ -222,13 +222,13 @@ namespace Echoion::Core
|
||||
"Failed to open audio source: {} (FFmpeg error {}: {})",
|
||||
url.substr(0, 80), ret, errbuf));
|
||||
}
|
||||
ECHOION_LOG_DEBUG("avformat_open_input succeeded");
|
||||
Void::Log::debug("AudioDecoder", "{}", "avformat_open_input succeeded");
|
||||
|
||||
ret = avformat_find_stream_info(formatContext_, nullptr);
|
||||
if (ret < 0) {
|
||||
char errbuf[256];
|
||||
av_strerror(ret, errbuf, sizeof(errbuf));
|
||||
ECHOION_LOG_ERROR(
|
||||
Void::Log::error("AudioDecoder", "{}",
|
||||
std::format("FFmpeg failed to find stream info (error {}): {}",
|
||||
ret, errbuf));
|
||||
avformat_close_input(&formatContext_);
|
||||
@@ -348,7 +348,7 @@ namespace Echoion::Core
|
||||
shouldExit_ = false;
|
||||
decodeThread_ = std::jthread(&AudioDecoder::decodeThread, this);
|
||||
|
||||
ECHOION_LOG_INFO(std::format(
|
||||
Void::Log::info("AudioDecoder", "{}", std::format(
|
||||
"Audio source opened: {} -> {} Hz, {} ch, in={} out=S16", url,
|
||||
outputSampleRate_, outputChannels_,
|
||||
av_get_sample_fmt_name(codecContext_->sample_fmt)));
|
||||
@@ -389,7 +389,7 @@ namespace Echoion::Core
|
||||
std::lock_guard<std::mutex> statsLock(statsMutex_);
|
||||
stats_.framesDecoded++;
|
||||
|
||||
ECHOION_LOG_DEBUG(std::format("Frame consumed: {} samples, {} ms",
|
||||
Void::Log::debug("AudioDecoder", "{}", std::format("Frame consumed: {} samples, {} ms",
|
||||
audio.view.samplesPerChannel() * 2,
|
||||
audio.timestamp.count()));
|
||||
|
||||
@@ -424,7 +424,7 @@ namespace Echoion::Core
|
||||
cv_.notify_one();
|
||||
|
||||
if (callCount <= 10 || callCount % 1000 == 0) {
|
||||
ECHOION_LOG_DEBUG(std::format(
|
||||
Void::Log::debug("AudioDecoder", "{}", std::format(
|
||||
"getNextChunk {}: returned {} samples, queue left: {}",
|
||||
callCount, outChunk.size(), int16Queue_.size()));
|
||||
}
|
||||
@@ -504,7 +504,7 @@ namespace Echoion::Core
|
||||
|
||||
void AudioDecoder::decodeThread()
|
||||
{
|
||||
ECHOION_LOG_DEBUG("Decode thread started");
|
||||
Void::Log::debug("AudioDecoder", "{}", "Decode thread started");
|
||||
constexpr int maxSamples = 4096;
|
||||
int packetsRead = 0;
|
||||
int framesProduced = 0;
|
||||
@@ -571,7 +571,7 @@ namespace Echoion::Core
|
||||
framesProduced++;
|
||||
|
||||
if (framesProduced <= 5) {
|
||||
ECHOION_LOG_DEBUG(
|
||||
Void::Log::debug("AudioDecoder", "{}",
|
||||
std::format("Decode produced frame {}: {} samples",
|
||||
framesProduced, chunk.size()));
|
||||
}
|
||||
@@ -611,7 +611,7 @@ namespace Echoion::Core
|
||||
eof_ = true;
|
||||
cv_.notify_all();
|
||||
|
||||
ECHOION_LOG_INFO(std::format("Decode finished. Packets: {}, Frames: {}",
|
||||
Void::Log::info("AudioDecoder", "{}", std::format("Decode finished. Packets: {}, Frames: {}",
|
||||
packetsRead, framesProduced));
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user