From fe9b00292ed280a05a43f75de199606e064e71dd Mon Sep 17 00:00:00 2001 From: Axel Cocat Date: Thu, 29 Dec 2022 11:57:56 +0100 Subject: [PATCH] feat: log commands output (#75) --- src/LuaEngine/GlobalMethods.h | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/LuaEngine/GlobalMethods.h b/src/LuaEngine/GlobalMethods.h index 28516d97ee..951a0c057b 100644 --- a/src/LuaEngine/GlobalMethods.h +++ b/src/LuaEngine/GlobalMethods.h @@ -1229,7 +1229,12 @@ namespace LuaGlobalFunctions { const char* command = Eluna::CHECKVAL(L, 1); #if defined TRINITY || AZEROTHCORE - eWorld->QueueCliCommand(new CliCommandHolder(nullptr, command, nullptr, nullptr)); + eWorld->QueueCliCommand(new CliCommandHolder(nullptr, command, [](void* obj, std::string_view view) + { + std::string str = { view.begin(), view.end() }; + str.erase(std::find_if(str.rbegin(), str.rend(), [](unsigned char ch) { return !std::isspace(ch); }).base(), str.end()); // Remove trailing spaces and line breaks + ELUNA_LOG_INFO("{}", str); + }, nullptr)); #elif defined MANGOS eWorld->QueueCliCommand(new CliCommandHolder(0, SEC_CONSOLE, nullptr, command, nullptr, nullptr)); #endif