Route plugin logging through the Void::Log facade

Rewrite the ~80 ECHOION_LOG_* sites in PluginInterface/CoreLoader to
Void::Log::<level>("<Subsystem>", "{}", <expr>); add <iostream> where the
deleted LoggerInterface.hpp previously pulled it in. The plugin shares the
process-wide Void::Log sink installed by Core.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
faumarayandClaude Opus 4.8 committed 2026-06-23 14:10:06 +03:00
1 parent b313ed7101
commit 9a61e01fda
2 files changed
+83 -82

No files matched your search

+21 -21
View File
@@ -1,4 +1,4 @@
#include "LoggerInterface.hpp" #include <Void/Log/Log.hpp>
#include "dylib.hpp" #include "dylib.hpp"
#include "echoion/plugin/CoreLoader.hpp" #include "echoion/plugin/CoreLoader.hpp"
#include <chrono> #include <chrono>
@@ -21,7 +21,7 @@ namespace Echoion::Plugin
std::lock_guard<std::mutex> lock(mutex_); std::lock_guard<std::mutex> lock(mutex_);
if (!currentLibraryPath_.empty() && if (!currentLibraryPath_.empty() &&
std::filesystem::exists(currentLibraryPath_)) { std::filesystem::exists(currentLibraryPath_)) {
ECHOION_LOG_INFO(std::format("Enabling auto-reload for: {}", Void::Log::info("CoreLoader", "{}", std::format("Enabling auto-reload for: {}",
currentLibraryPath_.string())); currentLibraryPath_.string()));
fileWatcher_.startWatching(currentLibraryPath_, fileWatcher_.startWatching(currentLibraryPath_,
@@ -33,7 +33,7 @@ namespace Echoion::Plugin
{ {
autoReloadEnabled_ = false; autoReloadEnabled_ = false;
fileWatcher_.stopWatching(); fileWatcher_.stopWatching();
ECHOION_LOG_INFO("Auto-reload disabled"); Void::Log::info("CoreLoader", "{}", "Auto-reload disabled");
} }
bool CoreLoader::isAutoReloadEnabled() const noexcept bool CoreLoader::isAutoReloadEnabled() const noexcept
@@ -47,7 +47,7 @@ namespace Echoion::Plugin
return; return;
} }
ECHOION_LOG_INFO( Void::Log::info("CoreLoader", "{}",
"Core file changed, scheduling hot reload after current track..."); "Core file changed, scheduling hot reload after current track...");
// Small delay to ensure file write is complete // Small delay to ensure file write is complete
@@ -69,7 +69,7 @@ namespace Echoion::Plugin
} }
} }
ECHOION_LOG_INFO( Void::Log::info("CoreLoader", "{}",
std::format("Playback active (track: {}), deferring reload " std::format("Playback active (track: {}), deferring reload "
"until track finishes", "until track finishes",
currentTrackId)); currentTrackId));
@@ -85,10 +85,10 @@ namespace Echoion::Plugin
// No playback, reload immediately // No playback, reload immediately
auto result = hotReload(currentLibraryPath_); auto result = hotReload(currentLibraryPath_);
if (!result) { if (!result) {
ECHOION_LOG_ERROR(std::format("Auto hot-reload failed: {}", Void::Log::error("CoreLoader", "{}", std::format("Auto hot-reload failed: {}",
result.error().message)); result.error().message));
} else { } else {
ECHOION_LOG_INFO("Auto hot-reload completed successfully"); Void::Log::info("CoreLoader", "{}", "Auto hot-reload completed successfully");
// Notify Plugin to re-register callbacks // Notify Plugin to re-register callbacks
if (hotReloadCallback_) { if (hotReloadCallback_) {
hotReloadCallback_(); hotReloadCallback_();
@@ -129,7 +129,7 @@ namespace Echoion::Plugin
void CoreLoader::waitForTrackAndReload( void CoreLoader::waitForTrackAndReload(
const std::filesystem::path& targetPath, const std::string& trackId) const std::filesystem::path& targetPath, const std::string& trackId)
{ {
ECHOION_LOG_INFO(std::format( Void::Log::info("CoreLoader", "{}", std::format(
"Waiting for track {} to finish before reload...", trackId)); "Waiting for track {} to finish before reload...", trackId));
// Poll every 500ms to check if the specific track finished // Poll every 500ms to check if the specific track finished
@@ -139,7 +139,7 @@ namespace Echoion::Plugin
std::this_thread::sleep_for(std::chrono::milliseconds(500)); std::this_thread::sleep_for(std::chrono::milliseconds(500));
} }
ECHOION_LOG_INFO("Track finished, starting hot reload"); Void::Log::info("CoreLoader", "{}", "Track finished, starting hot reload");
// Clear pending flag // Clear pending flag
{ {
@@ -151,10 +151,10 @@ namespace Echoion::Plugin
// Now do the reload // Now do the reload
auto result = hotReload(targetPath); auto result = hotReload(targetPath);
if (!result) { if (!result) {
ECHOION_LOG_ERROR(std::format("Deferred hot-reload failed: {}", Void::Log::error("CoreLoader", "{}", std::format("Deferred hot-reload failed: {}",
result.error().message)); result.error().message));
} else { } else {
ECHOION_LOG_INFO("Deferred hot-reload completed successfully"); Void::Log::info("CoreLoader", "{}", "Deferred hot-reload completed successfully");
// Notify Plugin to re-register callbacks // Notify Plugin to re-register callbacks
if (hotReloadCallback_) { if (hotReloadCallback_) {
hotReloadCallback_(); hotReloadCallback_();
@@ -238,13 +238,13 @@ namespace Echoion::Plugin
hotReloading_ = true; hotReloading_ = true;
ECHOION_LOG_INFO("Starting hot reload with temp file..."); Void::Log::info("CoreLoader", "{}", "Starting hot reload with temp file...");
// Step 1: Save state as opaque blob (Plugin doesn't know contents) // Step 1: Save state as opaque blob (Plugin doesn't know contents)
Api::StateBlob stateBlob; Api::StateBlob stateBlob;
if (core_) { if (core_) {
stateBlob = core_->saveState(); stateBlob = core_->saveState();
ECHOION_LOG_INFO( Void::Log::info("CoreLoader", "{}",
std::format("Saved state: version={}, size={} bytes", std::format("Saved state: version={}, size={} bytes",
stateBlob.version, stateBlob.size())); stateBlob.version, stateBlob.size()));
} }
@@ -300,13 +300,13 @@ namespace Echoion::Plugin
auto coreVersion = core_->getStateFormatVersion(); auto coreVersion = core_->getStateFormatVersion();
auto stateVersion = stateBlob.version; auto stateVersion = stateBlob.version;
ECHOION_LOG_INFO(std::format("Restoring state v{} to Core v{}", Void::Log::info("CoreLoader", "{}", std::format("Restoring state v{} to Core v{}",
stateVersion, coreVersion)); stateVersion, coreVersion));
if (core_->canRestoreStateVersion(stateVersion)) { if (core_->canRestoreStateVersion(stateVersion)) {
auto restoreResult = core_->restoreState(stateBlob); auto restoreResult = core_->restoreState(stateBlob);
if (!restoreResult) { if (!restoreResult) {
ECHOION_LOG_ERROR( Void::Log::error("CoreLoader", "{}",
std::format("Failed to restore state: {}", std::format("Failed to restore state: {}",
restoreResult.error().message)); restoreResult.error().message));
@@ -314,17 +314,17 @@ namespace Echoion::Plugin
if (restoreResult.error().code == if (restoreResult.error().code ==
Api::ErrorCode::IncompatibleVersion) { Api::ErrorCode::IncompatibleVersion) {
// Signal user to update/restart // Signal user to update/restart
ECHOION_LOG_WARNING("State version incompatible. " Void::Log::warn("CoreLoader", "{}", "State version incompatible. "
"User needs to update/restart."); "User needs to update/restart.");
// Optionally: notify through plugin interface // Optionally: notify through plugin interface
} }
// Continue with empty state - graceful degradation // Continue with empty state - graceful degradation
} else { } else {
ECHOION_LOG_INFO("State restored successfully"); Void::Log::info("CoreLoader", "{}", "State restored successfully");
} }
} else { } else {
ECHOION_LOG_WARNING(std::format( Void::Log::warn("CoreLoader", "{}", std::format(
"Cannot restore state v{} in Core v{}. " "Cannot restore state v{} in Core v{}. "
"Version age exceeds maximum supported ({} versions).", "Version age exceeds maximum supported ({} versions).",
stateVersion, coreVersion, stateVersion, coreVersion,
@@ -336,7 +336,7 @@ namespace Echoion::Plugin
currentLibraryPath_ = targetPath; currentLibraryPath_ = targetPath;
hotReloading_ = false; hotReloading_ = false;
ECHOION_LOG_INFO("Hot reload complete"); Void::Log::info("CoreLoader", "{}", "Hot reload complete");
return {}; return {};
} }
@@ -411,7 +411,7 @@ namespace Echoion::Plugin
loaded_ = true; loaded_ = true;
ECHOION_LOG_INFO(std::format( Void::Log::info("CoreLoader", "{}", std::format(
"Core library loaded (API version: {})", versionFunc())); "Core library loaded (API version: {})", versionFunc()));
return {}; return {};
@@ -434,7 +434,7 @@ namespace Echoion::Plugin
return {}; return {};
} }
ECHOION_LOG_INFO("Unloading core library..."); Void::Log::info("CoreLoader", "{}", "Unloading core library...");
if (core_) { if (core_) {
core_->shutdown(); core_->shutdown();
+62 -61
View File
@@ -1,5 +1,6 @@
#include <iostream>
#include <echoion/plugin/PluginInterface.hpp> #include <echoion/plugin/PluginInterface.hpp>
#include "LoggerInterface.hpp" #include <Void/Log/Log.hpp>
#include "teamspeak/public_definitions.h" #include "teamspeak/public_definitions.h"
#include "teamspeak/public_rare_definitions.h" #include "teamspeak/public_rare_definitions.h"
#include <cstring> #include <cstring>
@@ -55,7 +56,7 @@ namespace Echoion::Plugin
if (res != ERROR_ok) { if (res != ERROR_ok) {
char* errorMsg = nullptr; char* errorMsg = nullptr;
ts3Functions_->getErrorMessage(res, &errorMsg); ts3Functions_->getErrorMessage(res, &errorMsg);
ECHOION_LOG_ERROR(std::format( Void::Log::error("PluginInterface", "{}", std::format(
"Unable to register custom device: {}", "Unable to register custom device: {}",
errorMsg)); errorMsg));
ts3Functions_->freeMemory(errorMsg); ts3Functions_->freeMemory(errorMsg);
@@ -66,7 +67,7 @@ namespace Echoion::Plugin
}); });
initialized_ = true; initialized_ = true;
ECHOION_LOG_INFO("PluginInterface initialized with TeamSpeak functions " Void::Log::info("PluginInterface", "{}", "PluginInterface initialized with TeamSpeak functions "
"(audio deferred)"); "(audio deferred)");
return {}; return {};
} }
@@ -118,7 +119,7 @@ namespace Echoion::Plugin
ts3Functions_ = nullptr; ts3Functions_ = nullptr;
initialized_ = false; initialized_ = false;
ECHOION_LOG_INFO("PluginInterface shutdown"); Void::Log::info("PluginInterface", "{}", "PluginInterface shutdown");
return {}; return {};
} }
@@ -429,7 +430,7 @@ namespace Echoion::Plugin
std::max(maxSample, std::abs(static_cast<int>(data[i]))); std::max(maxSample, std::abs(static_cast<int>(data[i])));
} }
nonZeroTotal += nonZero; nonZeroTotal += nonZero;
ECHOION_LOG_DEBUG(std::format( Void::Log::debug("PluginInterface", "{}", std::format(
"sendAudioData {}: {} samples, nonZero={}/100, maxSample={}, " "sendAudioData {}: {} samples, nonZero={}/100, maxSample={}, "
"queueSize={}", "queueSize={}",
callCount, data.size(), nonZero, maxSample, callCount, data.size(), nonZero, maxSample,
@@ -438,7 +439,7 @@ namespace Echoion::Plugin
if (!initialized_ || !ts3Functions_) { if (!initialized_ || !ts3Functions_) {
if (callCount <= 10) { if (callCount <= 10) {
ECHOION_LOG_ERROR(std::format( Void::Log::error("PluginInterface", "{}", std::format(
"sendAudioData {}: not initialized", callCount)); "sendAudioData {}: not initialized", callCount));
} }
return Api::fail(Api::ErrorCode::ServiceUnavailable, return Api::fail(Api::ErrorCode::ServiceUnavailable,
@@ -447,7 +448,7 @@ namespace Echoion::Plugin
if (!audioDeviceOpen_) { if (!audioDeviceOpen_) {
if (callCount <= 10) { if (callCount <= 10) {
ECHOION_LOG_ERROR(std::format( Void::Log::error("PluginInterface", "{}", std::format(
"sendAudioData {}: audio device not open", callCount)); "sendAudioData {}: audio device not open", callCount));
} }
return Api::fail( return Api::fail(
@@ -506,7 +507,7 @@ namespace Echoion::Plugin
{ {
std::lock_guard<std::mutex> lock(eventMutex_); std::lock_guard<std::mutex> lock(eventMutex_);
eventCallbacks_.push_back(callback); eventCallbacks_.push_back(callback);
ECHOION_LOG_INFO( Void::Log::info("PluginInterface", "{}",
std::format("Event callback registered, total callbacks: {}", std::format("Event callback registered, total callbacks: {}",
eventCallbacks_.size())); eventCallbacks_.size()));
} }
@@ -523,7 +524,7 @@ namespace Echoion::Plugin
void PluginInterface::clearEventCallbacks() void PluginInterface::clearEventCallbacks()
{ {
std::lock_guard<std::mutex> lock(eventMutex_); std::lock_guard<std::mutex> lock(eventMutex_);
ECHOION_LOG_INFO( Void::Log::info("PluginInterface", "{}",
std::format("Clearing {} event callbacks", eventCallbacks_.size())); std::format("Clearing {} event callbacks", eventCallbacks_.size()));
eventCallbacks_.clear(); eventCallbacks_.clear();
} }
@@ -626,7 +627,7 @@ namespace Echoion::Plugin
serverConnectionHandlerId_ = 0; serverConnectionHandlerId_ = 0;
char* msg; char* msg;
ts3Functions_->getErrorMessage(error, &msg); ts3Functions_->getErrorMessage(error, &msg);
ECHOION_LOG_ERROR(std::format("GUI Connect failed: {}", msg)); Void::Log::error("PluginInterface", "{}", std::format("GUI Connect failed: {}", msg));
ts3Functions_->freeMemory(msg); ts3Functions_->freeMemory(msg);
return Api::fail( return Api::fail(
Api::ErrorCode::NetworkError, Api::ErrorCode::NetworkError,
@@ -636,11 +637,11 @@ namespace Echoion::Plugin
// Open audio device // Open audio device
auto audioResult = openAudioDevice(); auto audioResult = openAudioDevice();
if (!audioResult) { if (!audioResult) {
ECHOION_LOG_WARNING( Void::Log::warn("PluginInterface", "{}",
"Failed to open audio device, continuing without audio"); "Failed to open audio device, continuing without audio");
} }
ECHOION_LOG_INFO(std::format("Connecting to server {}:{} as {}", Void::Log::info("PluginInterface", "{}", std::format("Connecting to server {}:{} as {}",
config.address, config.port, config.address, config.port,
config.nickname)); config.nickname));
@@ -664,7 +665,7 @@ namespace Echoion::Plugin
unsigned int error = ts3Functions_->stopConnection( unsigned int error = ts3Functions_->stopConnection(
serverConnectionHandlerId_, "Echoion Bot disconnecting"); serverConnectionHandlerId_, "Echoion Bot disconnecting");
if (error != ERROR_ok) { if (error != ERROR_ok) {
ECHOION_LOG_WARNING( Void::Log::warn("PluginInterface", "{}",
std::format("Error stopping connection: {}", error)); std::format("Error stopping connection: {}", error));
} }
@@ -672,12 +673,12 @@ namespace Echoion::Plugin
error = ts3Functions_->destroyServerConnectionHandler( error = ts3Functions_->destroyServerConnectionHandler(
serverConnectionHandlerId_); serverConnectionHandlerId_);
if (error != ERROR_ok) { if (error != ERROR_ok) {
ECHOION_LOG_WARNING( Void::Log::warn("PluginInterface", "{}",
std::format("Error destroying connection handler: {}", error)); std::format("Error destroying connection handler: {}", error));
} }
serverConnectionHandlerId_ = 0; serverConnectionHandlerId_ = 0;
ECHOION_LOG_INFO("Disconnected from server"); Void::Log::info("PluginInterface", "{}", "Disconnected from server");
return {}; return {};
} }
@@ -715,22 +716,22 @@ namespace Echoion::Plugin
Api::Result<void> PluginInterface::registerAudioDevice() Api::Result<void> PluginInterface::registerAudioDevice()
{ {
ECHOION_LOG_DEBUG("registerAudioDevice called"); Void::Log::debug("PluginInterface", "{}", "registerAudioDevice called");
if (!ts3Functions_) { if (!ts3Functions_) {
ECHOION_LOG_ERROR("registerAudioDevice: ts3Functions_ is null"); Void::Log::error("PluginInterface", "{}", "registerAudioDevice: ts3Functions_ is null");
return Api::fail(Api::ErrorCode::ServiceUnavailable, return Api::fail(Api::ErrorCode::ServiceUnavailable,
"TS3 functions not available"); "TS3 functions not available");
} }
if (audioDeviceRegistered_) { if (audioDeviceRegistered_) {
ECHOION_LOG_DEBUG("registerAudioDevice: already registered"); Void::Log::debug("PluginInterface", "{}", "registerAudioDevice: already registered");
return {}; return {};
} }
// Check if registerCustomDevice is available (null pointer check) // Check if registerCustomDevice is available (null pointer check)
if (!ts3Functions_->registerCustomDevice) { if (!ts3Functions_->registerCustomDevice) {
ECHOION_LOG_WARNING( Void::Log::warn("PluginInterface", "{}",
"registerCustomDevice not available in this TeamSpeak version"); "registerCustomDevice not available in this TeamSpeak version");
return Api::fail(Api::ErrorCode::NotSupported, return Api::fail(Api::ErrorCode::NotSupported,
"Custom audio devices not supported by this " "Custom audio devices not supported by this "
@@ -738,7 +739,7 @@ namespace Echoion::Plugin
} }
// Register custom device for both capture and playback // Register custom device for both capture and playback
ECHOION_LOG_DEBUG(std::format("Registering device: {} at {}Hz, {}ch", Void::Log::debug("PluginInterface", "{}", std::format("Registering device: {} at {}Hz, {}ch",
AudioDeviceConfig::DEVICE_ID, AudioDeviceConfig::DEVICE_ID,
AudioDeviceConfig::SAMPLE_RATE, AudioDeviceConfig::SAMPLE_RATE,
AudioDeviceConfig::CHANNELS)); AudioDeviceConfig::CHANNELS));
@@ -752,7 +753,7 @@ namespace Echoion::Plugin
AudioDeviceConfig::CHANNELS); AudioDeviceConfig::CHANNELS);
if (error != ERROR_ok) { if (error != ERROR_ok) {
ECHOION_LOG_ERROR( Void::Log::error("PluginInterface", "{}",
std::format("registerCustomDevice failed: {}", error)); std::format("registerCustomDevice failed: {}", error));
return Api::fail( return Api::fail(
Api::ErrorCode::PluginError, Api::ErrorCode::PluginError,
@@ -761,7 +762,7 @@ namespace Echoion::Plugin
} }
audioDeviceRegistered_ = true; audioDeviceRegistered_ = true;
ECHOION_LOG_INFO("Audio device registered successfully"); Void::Log::info("PluginInterface", "{}", "Audio device registered successfully");
return {}; return {};
} }
@@ -779,7 +780,7 @@ namespace Echoion::Plugin
// Check if unregisterCustomDevice is available // Check if unregisterCustomDevice is available
if (!ts3Functions_->unregisterCustomDevice) { if (!ts3Functions_->unregisterCustomDevice) {
ECHOION_LOG_WARNING(""); Void::Log::warn("PluginInterface", "{}", "");
std::cerr << std::format( std::cerr << std::format(
"[WARNING] unregisterCustomDevice not available") "[WARNING] unregisterCustomDevice not available")
<< std::endl; << std::endl;
@@ -805,46 +806,46 @@ namespace Echoion::Plugin
Api::Result<void> PluginInterface::openAudioDevice() Api::Result<void> PluginInterface::openAudioDevice()
{ {
if (auto res = closeAudioDevice(); !res.has_value()) { if (auto res = closeAudioDevice(); !res.has_value()) {
ECHOION_LOG_ERROR( Void::Log::error("PluginInterface", "{}",
std::format("Not closed devices: {}", res.error().toString())); std::format("Not closed devices: {}", res.error().toString()));
} }
ECHOION_LOG_DEBUG("openAudioDevice called"); Void::Log::debug("PluginInterface", "{}", "openAudioDevice called");
if (!ts3Functions_) { if (!ts3Functions_) {
ECHOION_LOG_ERROR("openAudioDevice: ts3Functions_ is null"); Void::Log::error("PluginInterface", "{}", "openAudioDevice: ts3Functions_ is null");
return Api::fail(Api::ErrorCode::ServiceUnavailable, return Api::fail(Api::ErrorCode::ServiceUnavailable,
"TS3 functions not available"); "TS3 functions not available");
} }
if (!audioDeviceRegistered_) { if (!audioDeviceRegistered_) {
ECHOION_LOG_ERROR("openAudioDevice: device not registered"); Void::Log::error("PluginInterface", "{}", "openAudioDevice: device not registered");
return Api::fail(Api::ErrorCode::ServiceUnavailable, return Api::fail(Api::ErrorCode::ServiceUnavailable,
"Audio device not registered"); "Audio device not registered");
} }
if (audioDeviceOpen_) { if (audioDeviceOpen_) {
ECHOION_LOG_DEBUG("openAudioDevice: already open"); Void::Log::debug("PluginInterface", "{}", "openAudioDevice: already open");
return {}; return {};
} }
if (serverConnectionHandlerId_ == 0) { if (serverConnectionHandlerId_ == 0) {
ECHOION_LOG_ERROR("openAudioDevice: not connected (handler=0)"); Void::Log::error("PluginInterface", "{}", "openAudioDevice: not connected (handler=0)");
return Api::fail( return Api::fail(
Api::ErrorCode::ServiceUnavailable, "Not connected to server"); Api::ErrorCode::ServiceUnavailable, "Not connected to server");
} }
// Close any existing device first (in case it was left open) // Close any existing device first (in case it was left open)
ECHOION_LOG_DEBUG("Closing any existing device first..."); Void::Log::debug("PluginInterface", "{}", "Closing any existing device first...");
ts3Functions_->closePlaybackDevice(serverConnectionHandlerId_); ts3Functions_->closePlaybackDevice(serverConnectionHandlerId_);
ts3Functions_->closeCaptureDevice(serverConnectionHandlerId_); ts3Functions_->closeCaptureDevice(serverConnectionHandlerId_);
ECHOION_LOG_DEBUG("Opening playback device..."); Void::Log::debug("PluginInterface", "{}", "Opening playback device...");
unsigned int err = ts3Functions_->openPlaybackDevice( unsigned int err = ts3Functions_->openPlaybackDevice(
serverConnectionHandlerId_, "custom", AudioDeviceConfig::DEVICE_ID); serverConnectionHandlerId_, "custom", AudioDeviceConfig::DEVICE_ID);
if (err == ERROR_sound_device_already_registerred) { if (err == ERROR_sound_device_already_registerred) {
ECHOION_LOG_WARNING( Void::Log::warn("PluginInterface", "{}",
"Playback device already registered, treating as open"); "Playback device already registered, treating as open");
audioDeviceOpen_ = true; audioDeviceOpen_ = true;
return {}; return {};
@@ -855,14 +856,14 @@ namespace Echoion::Plugin
ts3Functions_->getErrorMessage(err, &msg); ts3Functions_->getErrorMessage(err, &msg);
std::string errStr = msg; std::string errStr = msg;
ts3Functions_->freeMemory(msg); ts3Functions_->freeMemory(msg);
ECHOION_LOG_ERROR( Void::Log::error("PluginInterface", "{}",
std::format("openPlaybackDevice failed: {}", errStr)); std::format("openPlaybackDevice failed: {}", errStr));
return Api::fail( return Api::fail(
Api::ErrorCode::PluginError, Api::ErrorCode::PluginError,
std::format("Failed to open playback device: {}", errStr)); std::format("Failed to open playback device: {}", errStr));
} }
ECHOION_LOG_DEBUG("Opening capture device..."); Void::Log::debug("PluginInterface", "{}", "Opening capture device...");
err = ts3Functions_->openCaptureDevice( err = ts3Functions_->openCaptureDevice(
serverConnectionHandlerId_, "custom", AudioDeviceConfig::DEVICE_ID); serverConnectionHandlerId_, "custom", AudioDeviceConfig::DEVICE_ID);
@@ -871,17 +872,17 @@ namespace Echoion::Plugin
ts3Functions_->getErrorMessage(err, &msg); ts3Functions_->getErrorMessage(err, &msg);
std::string errStr = msg; std::string errStr = msg;
ts3Functions_->freeMemory(msg); ts3Functions_->freeMemory(msg);
ECHOION_LOG_WARNING( Void::Log::warn("PluginInterface", "{}",
std::format("Failed to open capture device: {}", errStr)); std::format("Failed to open capture device: {}", errStr));
} }
audioDeviceOpen_ = true; audioDeviceOpen_ = true;
ECHOION_LOG_INFO("Audio device opened successfully"); Void::Log::info("PluginInterface", "{}", "Audio device opened successfully");
// Configure audio profile for optimal music playback // Configure audio profile for optimal music playback
auto profileResult = configureAudioProfile(); auto profileResult = configureAudioProfile();
if (!profileResult) { if (!profileResult) {
ECHOION_LOG_WARNING( Void::Log::warn("PluginInterface", "{}",
std::format("Failed to configure audio profile: {}", std::format("Failed to configure audio profile: {}",
profileResult.error().message)); profileResult.error().message));
// Continue anyway - audio will still work with default settings // Continue anyway - audio will still work with default settings
@@ -903,18 +904,18 @@ namespace Echoion::Plugin
unsigned int error = unsigned int error =
ts3Functions_->closePlaybackDevice(serverConnectionHandlerId_); ts3Functions_->closePlaybackDevice(serverConnectionHandlerId_);
if (error != ERROR_ok) { if (error != ERROR_ok) {
ECHOION_LOG_WARNING( Void::Log::warn("PluginInterface", "{}",
std::format("Error closing playback device: {}", error)); std::format("Error closing playback device: {}", error));
} }
error = ts3Functions_->closeCaptureDevice(serverConnectionHandlerId_); error = ts3Functions_->closeCaptureDevice(serverConnectionHandlerId_);
if (error != ERROR_ok) { if (error != ERROR_ok) {
ECHOION_LOG_WARNING( Void::Log::warn("PluginInterface", "{}",
std::format("Error closing capture device: {}", error)); std::format("Error closing capture device: {}", error));
} }
audioDeviceOpen_ = false; audioDeviceOpen_ = false;
ECHOION_LOG_INFO("Audio device closed"); Void::Log::info("PluginInterface", "{}", "Audio device closed");
return {}; return {};
} }
@@ -938,19 +939,19 @@ namespace Echoion::Plugin
{ {
std::lock_guard<std::mutex> lock(eventMutex_); std::lock_guard<std::mutex> lock(eventMutex_);
if (eventCallbacks_.empty()) { if (eventCallbacks_.empty()) {
ECHOION_LOG_WARNING( Void::Log::warn("PluginInterface", "{}",
"No event callbacks registered, event will be dropped!"); "No event callbacks registered, event will be dropped!");
return; return;
} }
ECHOION_LOG_DEBUG(std::format("Broadcasting event to {} callbacks", Void::Log::debug("PluginInterface", "{}", std::format("Broadcasting event to {} callbacks",
eventCallbacks_.size())); eventCallbacks_.size()));
for (size_t i = 0; i < eventCallbacks_.size(); ++i) { for (size_t i = 0; i < eventCallbacks_.size(); ++i) {
try { try {
ECHOION_LOG_DEBUG(std::format("Calling callback {}...", i)); Void::Log::debug("PluginInterface", "{}", std::format("Calling callback {}...", i));
eventCallbacks_[i](event); eventCallbacks_[i](event);
ECHOION_LOG_DEBUG(std::format("Callback {} completed", i)); Void::Log::debug("PluginInterface", "{}", std::format("Callback {} completed", i));
} catch (const std::exception& e) { } catch (const std::exception& e) {
ECHOION_LOG_ERROR( Void::Log::error("PluginInterface", "{}",
std::format("Event callback {} error: {}", i, e.what())); std::format("Event callback {} error: {}", i, e.what()));
} }
} }
@@ -1082,7 +1083,7 @@ namespace Echoion::Plugin
Api::ErrorCode::ServiceUnavailable, "Not connected to server"); Api::ErrorCode::ServiceUnavailable, "Not connected to server");
} }
ECHOION_LOG_INFO("Configuring audio profile for music bot..."); Void::Log::info("PluginInterface", "{}", "Configuring audio profile for music bot...");
// Configure preprocessor settings (noise reduction, echo cancellation, // Configure preprocessor settings (noise reduction, echo cancellation,
// etc.) These settings optimize the audio for music playback rather // etc.) These settings optimize the audio for music playback rather
@@ -1093,7 +1094,7 @@ namespace Echoion::Plugin
unsigned int error = ts3Functions_->setPreProcessorConfigValue( unsigned int error = ts3Functions_->setPreProcessorConfigValue(
serverConnectionHandlerId_, "denoise", "false"); serverConnectionHandlerId_, "denoise", "false");
if (error != ERROR_ok) { if (error != ERROR_ok) {
ECHOION_LOG_WARNING( Void::Log::warn("PluginInterface", "{}",
std::format("Failed to disable denoiser: {}", error)); std::format("Failed to disable denoiser: {}", error));
} }
@@ -1101,7 +1102,7 @@ namespace Echoion::Plugin
error = ts3Functions_->setPreProcessorConfigValue( error = ts3Functions_->setPreProcessorConfigValue(
serverConnectionHandlerId_, "agc", "false"); serverConnectionHandlerId_, "agc", "false");
if (error != ERROR_ok) { if (error != ERROR_ok) {
ECHOION_LOG_WARNING( Void::Log::warn("PluginInterface", "{}",
std::format("Failed to disable AGC: {}", error)); std::format("Failed to disable AGC: {}", error));
} }
@@ -1110,7 +1111,7 @@ namespace Echoion::Plugin
error = ts3Functions_->setPreProcessorConfigValue( error = ts3Functions_->setPreProcessorConfigValue(
serverConnectionHandlerId_, "vad", "false"); serverConnectionHandlerId_, "vad", "false");
if (error != ERROR_ok) { if (error != ERROR_ok) {
ECHOION_LOG_WARNING( Void::Log::warn("PluginInterface", "{}",
std::format("Failed to disable VAD: {}", error)); std::format("Failed to disable VAD: {}", error));
} }
@@ -1118,7 +1119,7 @@ namespace Echoion::Plugin
error = ts3Functions_->setPreProcessorConfigValue( error = ts3Functions_->setPreProcessorConfigValue(
serverConnectionHandlerId_, "echocancel", "false"); serverConnectionHandlerId_, "echocancel", "false");
if (error != ERROR_ok) { if (error != ERROR_ok) {
ECHOION_LOG_WARNING( Void::Log::warn("PluginInterface", "{}",
std::format("Failed to disable echo cancellation: {}", error)); std::format("Failed to disable echo cancellation: {}", error));
} }
@@ -1126,7 +1127,7 @@ namespace Echoion::Plugin
error = ts3Functions_->setPreProcessorConfigValue( error = ts3Functions_->setPreProcessorConfigValue(
serverConnectionHandlerId_, "echo_reduction", "false"); serverConnectionHandlerId_, "echo_reduction", "false");
if (error != ERROR_ok) { if (error != ERROR_ok) {
ECHOION_LOG_WARNING( Void::Log::warn("PluginInterface", "{}",
std::format("Failed to disable echo reduction: {}", error)); std::format("Failed to disable echo reduction: {}", error));
} }
@@ -1135,7 +1136,7 @@ namespace Echoion::Plugin
error = ts3Functions_->setPlaybackConfigValue( error = ts3Functions_->setPlaybackConfigValue(
serverConnectionHandlerId_, "typing_attenuation", "0"); serverConnectionHandlerId_, "typing_attenuation", "0");
if (error != ERROR_ok) { if (error != ERROR_ok) {
ECHOION_LOG_WARNING( Void::Log::warn("PluginInterface", "{}",
std::format("Failed to disable typing attenuation: {}", error)); std::format("Failed to disable typing attenuation: {}", error));
} }
@@ -1144,7 +1145,7 @@ namespace Echoion::Plugin
error = ts3Functions_->setClientSelfVariableAsInt( error = ts3Functions_->setClientSelfVariableAsInt(
serverConnectionHandlerId_, CLIENT_INPUT_DEACTIVATED, 0); serverConnectionHandlerId_, CLIENT_INPUT_DEACTIVATED, 0);
if (error != ERROR_ok) { if (error != ERROR_ok) {
ECHOION_LOG_WARNING(std::format( Void::Log::warn("PluginInterface", "{}", std::format(
"Failed to enable continuous transmission: {}", error)); "Failed to enable continuous transmission: {}", error));
} }
const char* returnCode = nullptr; const char* returnCode = nullptr;
@@ -1152,7 +1153,7 @@ namespace Echoion::Plugin
ts3Functions_->flushClientSelfUpdates(serverConnectionHandlerId_, ts3Functions_->flushClientSelfUpdates(serverConnectionHandlerId_,
returnCode); returnCode);
ECHOION_LOG_INFO("Audio profile configured successfully"); Void::Log::info("PluginInterface", "{}", "Audio profile configured successfully");
return {}; return {};
} }
@@ -1163,7 +1164,7 @@ namespace Echoion::Plugin
"TS3 functions not available"); "TS3 functions not available");
} }
ECHOION_LOG_INFO("Checking for first-run setup..."); Void::Log::info("PluginInterface", "{}", "Checking for first-run setup...");
// Check if we have a valid client identity // Check if we have a valid client identity
// TeamSpeak requires accepting TOS on first run, which is handled by // TeamSpeak requires accepting TOS on first run, which is handled by
@@ -1173,13 +1174,13 @@ namespace Echoion::Plugin
char* identity = nullptr; char* identity = nullptr;
unsigned int error = ts3Functions_->getClientLibVersion(&identity); unsigned int error = ts3Functions_->getClientLibVersion(&identity);
if (error != ERROR_ok || !identity) { if (error != ERROR_ok || !identity) {
ECHOION_LOG_WARNING( Void::Log::warn("PluginInterface", "{}",
"TeamSpeak client library not properly initialized"); "TeamSpeak client library not properly initialized");
ECHOION_LOG_INFO( Void::Log::info("PluginInterface", "{}",
"Please ensure TeamSpeak client is properly configured:"); "Please ensure TeamSpeak client is properly configured:");
ECHOION_LOG_INFO(" 1. Accept the Terms of Service"); Void::Log::info("PluginInterface", "{}", " 1. Accept the Terms of Service");
ECHOION_LOG_INFO(" 2. Create/obtain your identity"); Void::Log::info("PluginInterface", "{}", " 2. Create/obtain your identity");
ECHOION_LOG_INFO(" 3. Complete the initial setup wizard"); Void::Log::info("PluginInterface", "{}", " 3. Complete the initial setup wizard");
if (identity) { if (identity) {
ts3Functions_->freeMemory(identity); ts3Functions_->freeMemory(identity);
@@ -1193,7 +1194,7 @@ namespace Echoion::Plugin
ts3Functions_->freeMemory(identity); ts3Functions_->freeMemory(identity);
} }
ECHOION_LOG_INFO("TeamSpeak client is properly initialized"); Void::Log::info("PluginInterface", "{}", "TeamSpeak client is properly initialized");
return {}; return {};
} }