diff --git a/Code/Legacy/CrySystem/AZCoreLogSink.h b/Code/Legacy/CrySystem/AZCoreLogSink.h index 605367f418..39a6131262 100644 --- a/Code/Legacy/CrySystem/AZCoreLogSink.h +++ b/Code/Legacy/CrySystem/AZCoreLogSink.h @@ -36,9 +36,10 @@ public: Disconnect(); } - inline static void Connect() + inline static void Connect(bool suppressSystemOutput) { GetInstance().m_ignoredAsserts = new IgnoredAssertMap(); + GetInstance().m_suppressSystemOutput = suppressSystemOutput; GetInstance().BusConnect(); } @@ -179,23 +180,13 @@ public: { CryLog("(%s) - %s", window, message); } - - // If this is an editor-server, then allow the default trace behavior (fwrites to stdout) to occur - // The editor will being listening to the stdout of this server - if (const auto console = AZ::Interface::Get()) - { - bool editorsv_isDedicated = false; - if (console->GetCvarValue("editorsv_isDedicated", editorsv_isDedicated) == AZ::GetValueResult::Success) - { - return !editorsv_isDedicated; - } - } - - return true; // suppress default AzCore behavior. + + return m_suppressSystemOutput; } private: using IgnoredAssertMap = AZStd::unordered_map, AZStd::equal_to, AZ::OSStdAllocator>; IgnoredAssertMap* m_ignoredAsserts; + bool m_suppressSystemOutput = true; }; diff --git a/Code/Legacy/CrySystem/SystemInit.cpp b/Code/Legacy/CrySystem/SystemInit.cpp index c0c8607935..0bd57c254b 100644 --- a/Code/Legacy/CrySystem/SystemInit.cpp +++ b/Code/Legacy/CrySystem/SystemInit.cpp @@ -737,7 +737,18 @@ bool CSystem::Init(const SSystemInitParams& startupParams) m_pCmdLine = new CCmdLine(startupParams.szSystemCmdLine); - AZCoreLogSink::Connect(); + // Init AZCoreLogSink. Don't suppress system output if we're running as an editor-server + bool suppressSystemOutput = true; + if (const ICmdLineArg* isEditorServerArg = m_pCmdLine->FindArg(eCLAT_Pre, "editorsv_isDedicated")) + { + AZ::CVarFixedString lowercaseValue(isEditorServerArg->GetValue()); + AZStd::to_lower(lowercaseValue.begin(), lowercaseValue.end()); + if (lowercaseValue == "true") + { + suppressSystemOutput = false; + } + } + AZCoreLogSink::Connect(suppressSystemOutput); // Registers all AZ Console Variables functors specified within CrySystem if (auto azConsole = AZ::Interface::Get(); azConsole)