How do I use the Device Output Log window?

Hi, my goal is to be able to log debug info for a specific feature in my game to my its output window. I know UE_LOG logs messages but it logs them all to the same place so it gets cluttered. I saw there was a Device Out Log which looks like it lets you specify a custom device to be logged to. I did some research and ended up overriding FOutputDevice like so

.h

class PROJECTSMI_API MissionOutputDevice : public FOutputDevice
{
public:
	MissionOutputDevice();
	~MissionOutputDevice();

	virtual void Serialize(const TCHAR* V, ELogVerbosity::Type Verbosity, const FName& Category) override
	{
		// Not sure what I need to put here...
	}
};

.cpp

MissionOutputDevice::MissionOutputDevice()
{
	check(GLog);
	GLog->AddOutputDevice(this);
	if (GLog->IsRedirectingTo(this))
		return; // Never gets hit

	return;
}

MissionOutputDevice::~MissionOutputDevice()
{
	if (GLog != nullptr)
	{
		GLog->RemoveOutputDevice(this);
	}
}

Anyways, doing this never adds this custom output device to the Device Output Window as an option and when I debug it that line in the constructor if (GLog->IsRedirectingTo(this)) always returns false. Any help would be appreciated.

Hi Blindopoly,

Making a new output device and adding it to GLog does not influence the Output Log. The device output log also won’t help you there.

In short:
In your serialize you would have something like:

static const FName MyCategory(TEXT("MyCategory"));
if (Category == MyCategory)
{
  OnMyCategoryMessage.Broadcast(V, Verbosity);
}

You would then need to implement a custom log viewer UI that subscribes to the OnMyCategoryMessage event and adds it to the list of things to show when the event triggers.

You can implement this yourself, but what you want is: Log Viewer in Code Plugins - UE Marketplace
It’s a free marketplace plugin (I’m not the author). You can either use it as is, or study its source and figure out how it works.

As per your comment on How to subscribe to/redirect log messages? - Programming & Scripting - Epic Developer Community Forums will the above sample redirect the logs to this output device?
I am trying to listen to every log via UE_LOG macro as FString so I can call custom methods on it.