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>
57 lines
1.2 KiB
C++
57 lines
1.2 KiB
C++
#pragma once
|
|
|
|
#include "Command.hpp"
|
|
#include <Void/Log/Log.hpp>
|
|
#include <format>
|
|
|
|
namespace Echoion::Core
|
|
{
|
|
|
|
class SubscribeCommand : public Command
|
|
{
|
|
public:
|
|
|
|
void execute(const CommandContext& ctx) override
|
|
{
|
|
try {
|
|
auto manager = ctx.musicManager.lock();
|
|
if (!manager) {
|
|
ctx.reply(
|
|
"The music service is currently unavailable.");
|
|
return;
|
|
}
|
|
|
|
auto result = manager->subscribe(ctx.clientId);
|
|
if (!result) {
|
|
Void::Log::error("SubscribeCommand", "{}", std::format("Subscribe failed: {}",
|
|
result.error().message));
|
|
ctx.reply("Couldn't subscribe you. Please try again.");
|
|
return;
|
|
}
|
|
|
|
ctx.reply(*result);
|
|
} catch (const std::exception& e) {
|
|
Void::Log::error("SubscribeCommand", "{}", std::format(
|
|
"Subscribe command exception: {}", e.what()));
|
|
ctx.reply("Something went wrong. Please try again.");
|
|
}
|
|
}
|
|
|
|
std::string_view getDescription() const override
|
|
{
|
|
return "Subscribes to the music bot to receive audio.";
|
|
}
|
|
|
|
CommandCategory getCategory() const override
|
|
{
|
|
return CommandCategory::Utility;
|
|
}
|
|
|
|
std::vector<std::string_view> getAliases() const override
|
|
{
|
|
return {"sub", "join"};
|
|
}
|
|
};
|
|
|
|
} // namespace Echoion::Core
|