UDocumentation UE5.7 10.02.2026 (Source)
API documentation for Unreal Engine 5.7
FOutputDeviceFile Class Reference

#include <OutputDeviceFile.h>

+ Inheritance diagram for FOutputDeviceFile:

Classes

struct  FCategoryInclusionInternal
 

Public Member Functions

CORE_API FOutputDeviceFile (const TCHAR *InFilename=nullptr, bool bDisableBackup=false, bool bAppendIfExists=false, bool bCreateWriterLazily=true, TFunction< void(const TCHAR *)> FileOpenedCallback=TFunction< void(const TCHAR *)>())
 
CORE_API ~FOutputDeviceFile ()
 
CORE_API void SetFilename (const TCHAR *InFilename)
 
CORE_API void TearDown () override
 
CORE_API void Flush () override
 
virtual CORE_API void Serialize (const TCHAR *Data, ELogVerbosity::Type Verbosity, const class FName &Category, const double Time) override
 
virtual CORE_API void Serialize (const TCHAR *Data, ELogVerbosity::Type Verbosity, const class FName &Category) override
 
virtual bool CanBeUsedOnAnyThread () const override
 
virtual bool CanBeUsedOnPanicThread () const override
 
CORE_API void IncludeCategory (const class FName &InCategoryName)
 
const TCHARGetFilename () const
 
CORE_API bool IsOpened () 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 ()
 
virtual void Serialize (const TCHAR *V, ELogVerbosity::Type Verbosity, const FName &Category)=0
 
virtual void Serialize (const TCHAR *V, ELogVerbosity::Type Verbosity, const FName &Category, const double Time)
 
virtual CORE_API void SerializeRecord (const UE::FLogRecord &Record)
 
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 CanBeUsedOnMultipleThreads () 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 void CreateBackupCopy (const TCHAR *Filename)
 
static CORE_API bool IsBackupCopy (const TCHAR *Filename)
 

Additional Inherited Members

- Protected Attributes inherited from FOutputDevice
bool bSuppressEventTag
 
bool bAutoEmitLineTerminator
 

Detailed Description

File output device (Note: Only works if ALLOW_LOG_FILE && !NO_LOGGING is true, otherwise Serialize does nothing).

Constructor & Destructor Documentation

◆ FOutputDeviceFile()

FOutputDeviceFile::FOutputDeviceFile ( const TCHAR InFilename = nullptr,
bool  bInDisableBackup = false,
bool  bInAppendIfExists = false,
bool  bCreateWriterLazily = true,
TFunction< void(const TCHAR *)>  FileOpenedCallback = TFunction<void(const TCHAR*)>() 
)

Constructor, initializing member variables.

Parameters
InFilenameFilename to use, can be nullptr. If null, a file name will be automatically generated. If a filename is specified but cannot be opened because it is already open/used by another process, the implementation will try to generate a new name automatically, until the a file is created or the number of trials exhausted (32).
bDisableBackupIf true, existing files will not be backed up
bCreateWriterLazilyIf true, delay the creation of the file until something needs to be written, otherwise, open it immediatedly.
FileOpenedCallbackIf bound, invoked when the output file is successfully opened, passing the actual filename.

Constructor, initializing member variables.

Parameters
InFilenameFilename to use, can be NULL
bInDisableBackupIf true, existing files will not be backed up

◆ ~FOutputDeviceFile()

FOutputDeviceFile::~FOutputDeviceFile ( )

Destructor to perform teardown

Member Function Documentation

◆ CanBeUsedOnAnyThread()

virtual bool FOutputDeviceFile::CanBeUsedOnAnyThread ( ) const
inlineoverridevirtual
Returns
whether this output device can be used on any thread.

Reimplemented from FOutputDevice.

◆ CanBeUsedOnPanicThread()

virtual bool FOutputDeviceFile::CanBeUsedOnPanicThread ( ) const
inlineoverridevirtual
Returns
whether this output device can be used after a panic (crash or fatal error) has been flagged.
Note
The return value is cached by AddOutputDevice because calling this during a panic may fail.

Reimplemented from FOutputDevice.

◆ CreateBackupCopy()

void FOutputDeviceFile::CreateBackupCopy ( const TCHAR Filename)
static

Creates a backup copy of a log file if it already exists

if the passed in file exists, makes a timestamped backup copy

Parameters
Filenamethe name of the file to check

◆ Flush()

void FOutputDeviceFile::Flush ( void  )
overridevirtual

Flush the write cache so the file isn't truncated in case we crash right after calling this function.

Reimplemented from FOutputDevice.

◆ GetFilename()

const TCHAR * FOutputDeviceFile::GetFilename ( ) const
inline

Returns the filename associated with this output device

◆ IncludeCategory()

void FOutputDeviceFile::IncludeCategory ( const class FName InCategoryName)

Add a category name to our inclusion filter. As soon as one inclusion exists, all others will be ignored

◆ IsBackupCopy()

bool FOutputDeviceFile::IsBackupCopy ( const TCHAR Filename)
static

Checks if the filename represents a backup copy of a log file

◆ IsOpened()

bool FOutputDeviceFile::IsOpened ( ) const

◆ Serialize() [1/2]

void FOutputDeviceFile::Serialize ( const TCHAR Data,
ELogVerbosity::Type  Verbosity,
const class FName Category 
)
overridevirtual

◆ Serialize() [2/2]

void FOutputDeviceFile::Serialize ( const TCHAR Data,
ELogVerbosity::Type  Verbosity,
const class FName Category,
const double  Time 
)
overridevirtual

Serializes the passed in data unless the current event is suppressed.

Parameters
DataText to log
EventEvent name used for suppression purposes

Reimplemented in FIOSOutputDeviceFile.

◆ SetFilename()

void FOutputDeviceFile::SetFilename ( const TCHAR InFilename)

Sets the filename that the output device writes to. If the output device was already writing to a file, closes that file.

◆ TearDown()

void FOutputDeviceFile::TearDown ( void  )
overridevirtual

Closes output device and cleans up. This can't happen in the destructor as we have to call "delete" which cannot be done for static/ global objects.

Reimplemented from FOutputDevice.


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