aboutsummaryrefslogtreecommitdiff
path: root/Minecraft.Client/Common/Consoles_App.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'Minecraft.Client/Common/Consoles_App.cpp')
-rw-r--r--Minecraft.Client/Common/Consoles_App.cpp117
1 files changed, 69 insertions, 48 deletions
diff --git a/Minecraft.Client/Common/Consoles_App.cpp b/Minecraft.Client/Common/Consoles_App.cpp
index c3a623d5..0a2fd159 100644
--- a/Minecraft.Client/Common/Consoles_App.cpp
+++ b/Minecraft.Client/Common/Consoles_App.cpp
@@ -38,6 +38,9 @@
#include "GameRules\ConsoleSchematicFile.h"
#include "..\User.h"
#include "..\..\Minecraft.World\LevelData.h"
+#if defined(_WINDOWS64) && defined(MINECRAFT_SERVER_BUILD)
+#include "..\..\Minecraft.Server\ServerLogManager.h"
+#endif
#include "..\..\Minecraft.World\net.minecraft.world.entity.player.h"
#include "..\EntityRenderDispatcher.h"
#include "..\..\Minecraft.World\compression.h"
@@ -240,12 +243,21 @@ void CMinecraftApp::DebugPrintf(const char *szFormat, ...)
{
#ifndef _FINAL_BUILD
- char buf[1024];
- va_list ap;
- va_start(ap, szFormat);
- vsnprintf(buf, sizeof(buf), szFormat, ap);
- va_end(ap);
- OutputDebugStringA(buf);
+ va_list ap;
+ va_start(ap, szFormat);
+#if defined(_WINDOWS64) && defined(MINECRAFT_SERVER_BUILD)
+ // Dedicated server routes client debug spew through ServerLogger so CLI output stays prompt-safe.
+ if (ServerRuntime::ServerLogManager::ShouldForwardClientDebugLogs())
+ {
+ ServerRuntime::ServerLogManager::ForwardClientAppDebugLogV(szFormat, ap);
+ va_end(ap);
+ return;
+ }
+#endif
+ char buf[1024];
+ vsnprintf(buf, sizeof(buf), szFormat, ap);
+ va_end(ap);
+ OutputDebugStringA(buf);
#endif
}
@@ -253,53 +265,62 @@ void CMinecraftApp::DebugPrintf(const char *szFormat, ...)
void CMinecraftApp::DebugPrintf(int user, const char *szFormat, ...)
{
#ifndef _FINAL_BUILD
- if(user == USER_NONE)
- return;
- char buf[1024];
- va_list ap;
- va_start(ap, szFormat);
- vsnprintf(buf, sizeof(buf), szFormat, ap);
- va_end(ap);
+ if(user == USER_NONE)
+ return;
+ va_list ap;
+ va_start(ap, szFormat);
+#if defined(_WINDOWS64) && defined(MINECRAFT_SERVER_BUILD)
+ // Dedicated server routes client debug spew through ServerLogger so CLI output stays prompt-safe.
+ if (ServerRuntime::ServerLogManager::ShouldForwardClientDebugLogs())
+ {
+ ServerRuntime::ServerLogManager::ForwardClientUserDebugLogV(user, szFormat, ap);
+ va_end(ap);
+ return;
+ }
+#endif
+ char buf[1024];
+ vsnprintf(buf, sizeof(buf), szFormat, ap);
+ va_end(ap);
#ifdef __PS3__
- unsigned int writelen;
- sys_tty_write(SYS_TTYP_USER1 + ( user - 1 ), buf, strlen(buf), &writelen );
+ unsigned int writelen;
+ sys_tty_write(SYS_TTYP_USER1 + ( user - 1 ), buf, strlen(buf), &writelen );
#elif defined __PSVITA__
- switch(user)
- {
- case 0:
- {
- SceUID tty2 = sceIoOpen("tty2:", SCE_O_WRONLY, 0);
- if(tty2>=0)
- {
- std::string string1(buf);
- sceIoWrite(tty2, string1.c_str(), string1.length());
- sceIoClose(tty2);
- }
- }
- break;
- case 1:
- {
- SceUID tty3 = sceIoOpen("tty3:", SCE_O_WRONLY, 0);
- if(tty3>=0)
- {
- std::string string1(buf);
- sceIoWrite(tty3, string1.c_str(), string1.length());
- sceIoClose(tty3);
- }
- }
- break;
- default:
- OutputDebugStringA(buf);
- break;
- }
+ switch(user)
+ {
+ case 0:
+ {
+ SceUID tty2 = sceIoOpen("tty2:", SCE_O_WRONLY, 0);
+ if(tty2>=0)
+ {
+ std::string string1(buf);
+ sceIoWrite(tty2, string1.c_str(), string1.length());
+ sceIoClose(tty2);
+ }
+ }
+ break;
+ case 1:
+ {
+ SceUID tty3 = sceIoOpen("tty3:", SCE_O_WRONLY, 0);
+ if(tty3>=0)
+ {
+ std::string string1(buf);
+ sceIoWrite(tty3, string1.c_str(), string1.length());
+ sceIoClose(tty3);
+ }
+ }
+ break;
+ default:
+ OutputDebugStringA(buf);
+ break;
+ }
#else
- OutputDebugStringA(buf);
+ OutputDebugStringA(buf);
#endif
#ifndef _XBOX
- if(user == USER_UI)
- {
- ui.logDebugString(buf);
- }
+ if(user == USER_UI)
+ {
+ ui.logDebugString(buf);
+ }
#endif
#endif
}