UDocumentation UE5.7 10.02.2026 (Source)
API documentation for Unreal Engine 5.7
FOutputDeviceRedirector Class Referencefinal

#include <OutputDeviceRedirector.h>

+ Inheritance diagram for FOutputDeviceRedirector:

Public Member Functions

CORE_API FOutputDeviceRedirector ()
 
CORE_API ~FOutputDeviceRedirector ()
 
CORE_API void AddOutputDevice (FOutputDevice *OutputDevice)
 
CORE_API void RemoveOutputDevice (FOutputDevice *OutputDevice)
 
CORE_API bool IsRedirectingTo (FOutputDevice *OutputDevice)
 
CORE_API void FlushThreadedLogs (EOutputDeviceRedirectorFlushOptions Options=EOutputDeviceRedirectorFlushOptions::None)
 
CORE_API void SerializeBacklog (FOutputDevice *OutputDevice)
 
CORE_API void EnableBacklog (bool bEnable)
 
CORE_API void SetCurrentThreadAsPrimaryThread ()
 
CORE_API bool TryStartDedicatedPrimaryThread ()
 
CORE_API void SerializeRecord (const UE::FLogRecord &Record) final
 
CORE_API void Serialize (const TCHAR *Data, ELogVerbosity::Type Verbosity, const FName &Category, const double Time) final
 
CORE_API void Serialize (const TCHAR *Data, ELogVerbosity::Type Verbosity, const FName &Category) final
 
CORE_API void RedirectLog (const FName &Category, ELogVerbosity::Type Verbosity, const TCHAR *Data)
 
CORE_API void RedirectLog (const FLazyName &Category, ELogVerbosity::Type Verbosity, const TCHAR *Data)
 
CORE_API FOutputDeviceFence CreateFence ()
 
CORE_API void Flush () final
 
CORE_API void Panic ()
 
CORE_API void TearDown () final
 
CORE_API bool IsBacklogEnabled () const
 
UE_INTERNAL bool HasBacklogForCrash () const
 
UE_INTERNAL void SerializeBacklogForCrash (TNotNull< FOutputDevice * > OutputDevice) const
 
- Public Member Functions inherited from FOutputDevice
CORE_API FOutputDevice ()
 
CORE_API FOutputDevice (FOutputDevice &&)
 
CORE_API FOutputDevice (const FOutputDevice &)
 
CORE_API FOutputDeviceoperator= (FOutputDevice &&)
 
CORE_API FOutputDeviceoperator= (const FOutputDevice &)
 
virtual CORE_API ~FOutputDevice ()
 
void SetSuppressEventTag (bool bInSuppressEventTag)
 
UE_FORCEINLINE_HINT bool GetSuppressEventTag () const
 
void SetAutoEmitLineTerminator (bool bInAutoEmitLineTerminator)
 
UE_FORCEINLINE_HINT bool GetAutoEmitLineTerminator () const
 
virtual void Dump (class FArchive &Ar)
 
virtual bool IsMemoryOnly () const
 
virtual bool CanBeUsedOnAnyThread () const
 
virtual bool CanBeUsedOnMultipleThreads () const
 
virtual bool CanBeUsedOnPanicThread () const
 
CORE_API void Log (const TCHAR *S)
 
CORE_API void Log (ELogVerbosity::Type Verbosity, const TCHAR *S)
 
CORE_API void Log (const FName &Category, ELogVerbosity::Type Verbosity, const TCHAR *Str)
 
CORE_API void Log (const FString &S)
 
CORE_API void Log (const FText &S)
 
CORE_API void Log (ELogVerbosity::Type Verbosity, const FString &S)
 
CORE_API void Log (const FName &Category, ELogVerbosity::Type Verbosity, const FString &S)
 
template<typename FmtType >
void Logf (const FmtType &Fmt)
 
template<typename FmtType , typename... Types>
void Logf (const FmtType &Fmt, Types... Args)
 
template<typename FmtType , typename... Types>
void Logf (ELogVerbosity::Type Verbosity, const FmtType &Fmt, Types... Args)
 
template<typename FmtType , typename... Types>
void CategorizedLogf (const FName &Category, ELogVerbosity::Type Verbosity, const FmtType &Fmt, Types... Args)
 

Static Public Member Functions

static CORE_API FOutputDeviceRedirectorGet ()
 

Additional Inherited Members

- Protected Attributes inherited from FOutputDevice
bool bSuppressEventTag
 
bool bAutoEmitLineTerminator
 

Detailed Description

Class used for output redirection to allow logs to show in multiple output devices.

Constructor & Destructor Documentation

◆ FOutputDeviceRedirector()

UE_AUTORTFM_NOAUTORTFM FOutputDeviceRedirector::FOutputDeviceRedirector ( )

Initialization constructor.

◆ ~FOutputDeviceRedirector()

UE_AUTORTFM_NOAUTORTFM FOutputDeviceRedirector::~FOutputDeviceRedirector ( )

Destructor

Member Function Documentation

◆ AddOutputDevice()

UE_AUTORTFM_NOAUTORTFM void FOutputDeviceRedirector::AddOutputDevice ( FOutputDevice OutputDevice)

Adds an output device to the chain of redirections.

Parameters
OutputDeviceOutput device to add.

◆ CreateFence()

UE_AUTORTFM_NOAUTORTFM FOutputDeviceFence FOutputDeviceRedirector::CreateFence ( )

Creates a fence that tracks the status of async operations started prior to creation of the fence.

The fence is considered complete when every log prior to the fence has been broadcast to every output device.

◆ EnableBacklog()

UE_AUTORTFM_NOAUTORTFM void FOutputDeviceRedirector::EnableBacklog ( bool  bEnable)

Enables or disables the backlog.

Parameters
bEnableStarts saving a backlog if true, disables and discards any backlog if false.

◆ Flush()

UE_AUTORTFM_ALWAYS_OPEN void FOutputDeviceRedirector::Flush ( void  )
finalvirtual

Passes on the flush request to all current output devices.

Reimplemented from FOutputDevice.

◆ FlushThreadedLogs()

Flushes lines buffered by secondary threads.

◆ Get()

FOutputDeviceRedirector * FOutputDeviceRedirector::Get ( )
static

Get the GLog singleton.

◆ HasBacklogForCrash()

bool FOutputDeviceRedirector::HasBacklogForCrash ( ) const

Internal. Used for crash reporting.

◆ IsBacklogEnabled()

UE_AUTORTFM_ALWAYS_OPEN bool FOutputDeviceRedirector::IsBacklogEnabled ( ) const

Determine if the backlog is enabled.

◆ IsRedirectingTo()

UE_AUTORTFM_ALWAYS_OPEN bool FOutputDeviceRedirector::IsRedirectingTo ( FOutputDevice OutputDevice)

Returns whether an output device is in the list of redirections.

Parameters
OutputDeviceOutput device to check the list against.
Returns
true if messages are currently redirected to the the passed in output device, false otherwise.

◆ Panic()

UE_AUTORTFM_ALWAYS_OPEN void FOutputDeviceRedirector::Panic ( )

Attempts to set the calling thread as the panic thread and enable panic mode.

Only one thread can be the panic thread. Subsequent calls from other threads are ignored. Only redirects logs to panic-safe output devices from this point forward. Makes the calling thread the primary log thread as well. Flushes buffered logs to panic-safe output devices. Flushes panic-safe output devices.

◆ RedirectLog() [1/2]

void FOutputDeviceRedirector::RedirectLog ( const FLazyName Category,
ELogVerbosity::Type  Verbosity,
const TCHAR Data 
)

◆ RedirectLog() [2/2]

void FOutputDeviceRedirector::RedirectLog ( const FName Category,
ELogVerbosity::Type  Verbosity,
const TCHAR Data 
)

Same as Serialize().

◆ RemoveOutputDevice()

UE_AUTORTFM_NOAUTORTFM void FOutputDeviceRedirector::RemoveOutputDevice ( FOutputDevice OutputDevice)

Removes an output device from the chain of redirections.

Parameters
OutputDeviceOutput device to remove.

◆ Serialize() [1/2]

void FOutputDeviceRedirector::Serialize ( const TCHAR Data,
ELogVerbosity::Type  Verbosity,
const FName Category 
)
finalvirtual

Serializes the passed in data via all current output devices.

Parameters
DataText to log.
EventEvent name used for suppression purposes.

Implements FOutputDevice.

◆ Serialize() [2/2]

UE_AUTORTFM_ALWAYS_OPEN void FOutputDeviceRedirector::Serialize ( const TCHAR Data,
ELogVerbosity::Type  Verbosity,
const FName Category,
const double  Time 
)
finalvirtual

Serializes the passed in data via all current output devices.

Parameters
DataText to log.
EventEvent name used for suppression purposes.

Reimplemented from FOutputDevice.

◆ SerializeBacklog()

UE_AUTORTFM_ALWAYS_OPEN void FOutputDeviceRedirector::SerializeBacklog ( FOutputDevice OutputDevice)

Serializes the current backlog to the specified output device.

Parameters
OutputDeviceOutput device that will receive the current backlog.

◆ SerializeBacklogForCrash()

void FOutputDeviceRedirector::SerializeBacklogForCrash ( TNotNull< FOutputDevice * >  OutputDevice) const

Internal. Used for crash reporting.

◆ SerializeRecord()

UE_AUTORTFM_ALWAYS_OPEN void FOutputDeviceRedirector::SerializeRecord ( const UE::FLogRecord Record)
finalvirtual

Serializes the log record via all current output devices.

All pointers in the record must remain valid until completion of a fence created after this call.

Reimplemented from FOutputDevice.

◆ SetCurrentThreadAsPrimaryThread()

UE_AUTORTFM_NOAUTORTFM void FOutputDeviceRedirector::SetCurrentThreadAsPrimaryThread ( )

Sets the current thread to be the thread that redirects logs to buffered output devices.

The current thread can redirect to buffered output devices without buffering, and becomes responsible for flushing buffered logs from secondary threads. Logs from secondary threads will not be redirected unless the current thread periodically flushes threaded logs.

◆ TearDown()

UE_AUTORTFM_NOAUTORTFM void FOutputDeviceRedirector::TearDown ( void  )
finalvirtual

Closes output device and cleans up.

This can't happen in the destructor as we might have to call "delete" which cannot be done for static/global objects.

Reimplemented from FOutputDevice.

◆ TryStartDedicatedPrimaryThread()

UE_AUTORTFM_NOAUTORTFM bool FOutputDeviceRedirector::TryStartDedicatedPrimaryThread ( )

Starts a dedicated primary thread that redirects logs to buffered output devices.

A thread will not be started for certain configurations or platforms, or when threading is disabled.

Returns
true if a dedicated primary logging thread is running, false otherwise.

The documentation for this class was generated from the following files: