FMessageLog
is an object that allows you to write output messages to the Message Log (Window | Developer Tools | Message Log) and Output Log (Window | Developer Tools | Output Log) simultaneously.
Have your project ready and some information to log to Message Log. Display Message Log in your UE4 Editor. The following screenshot is of the Message Log:
Add
#define
to your main header file (ProjectName.h
) definingLOCTEXT_NAMESPACE
as something unique to your codebase:#define LOCTEXT_NAMESPACE "Chapter12Namespace"
This
#define
is used by theLOCTEXT()
macro, which we use to generateFText
objects, but is not seen in output messages.Declare your
FMessageLog
by constructing it somewhere very global. You can useextern
in yourProjectName.h
file. Consider the following piece of code as an example:extern FName LoggerName; extern FMessageLog Logger;
And then, create your
FMessageLog
by defining it in a.cpp...