Download

Networking CLIENT/SERVER Logging outputs

Hey,
I’m currently struggling with setting up my Logging so that it decently works with networking debugging:

I want to be able to distinguish Logs coming from my dedicated server and the client running inside the Unreal Editor, since apparently they both log everything to the same Output Log.

something like just writing CLIENT: and SERVER: before each log, but I’m having big problems trying to wrap the UE_LOG macro properly, so that I can pass arguments in the same way, e.g.:


UE_LOG(LogClass, Log, TEXT("%s pawn begin play: %s .. ROLE on machine: %s / REMOTE ROLE: %s  "),
		(IsLocallyControlled() ? TEXT("LOCAL") : TEXT("proxy")),
		*GetName(),
		*UEnum::GetValueAsString(TEXT("Engine.ENetRole"), Role),
		*UEnum::GetValueAsString(TEXT("Engine.ENetRole"), GetRemoteRole()))

sadly dealing with variadic functions in c++ is a huge pain, and I am still very new with C++ programming, so help would be HIGHLY appreciated

Alternatively, if somebody knows how I can set up the Output Log properly in the editor so that I can distinguish CLIENT and SERVER logs, it would be also very helpful
(I’m currently using 4.14, but I’d upgrade in an instant if it helps)

I’d like to be able to do the same thing in PIE. I think the problem is that when using PIE, everything runs in a single process and so the log statements cannot tell where they are. So far, the only way I’ve been able to do this is to run separate processes for clients and server (which increases startup time to play).

perhaps use a different LogClass depending on Role/RemoteRole ?