A guide on how to use this plugin
Once you've installed the Debug Logging Library plugin into the engine, and you've enabled it, we can begin using this in your project.
Let's start by opening up the level blueprint and log a simple warning message to the console and viewport.
Drag off the begin play node and type in 'Warning'
Type in a message!
Compile and save. Now press play and you should see your message in the Output Log window. Like this:
If you change the Logging Option parameter value to 'Viewport', it should log to the viewport. Like this:
And if you change the Logging Option parameter value to 'Disabled', the function will not log.
That's really all there is to it!
How to use the plugin in C++
Before we can use this plugin in C++, we first need to modify your [PROJECTNAME].Build.cs file to include the Debug module. To do that, open up your Visual Studio solution, go to Source>[PROJECTNAME] and open [PROJECTNAME].Build.cs. You will see PrivateDependencyModuleNames, it's empty. If you don't have this, just add it in under PublicDependencyModuleNames. Add "Debug" inside the new string array, just like the image below.
Once that is done, save the file, close Visual Studio and close your Unreal project. Go to your Unreal project directory, delete .vs, Binaries, Intermediate folder. Right-click on [PROJECTNAME].uproject, click Generate Visual Studio project files. Once that's done, double click on your .uproject file to open up your project, it will ask you to rebuild the binaries, click Yes. It will take about a minute or less, depending on your computer and how many source files you have. Now we can use this anywhere in your game module!
To test it out, create a dummy actor class, include
Log.h and type in
ULog::Hello(); in BeginPlay. Like this:
Save the file, go back to unreal and hit Compile (next to the play button). Once that's done, hit play and look at your Output Log window, you should see a hello message, like this:
And if you want to output that message to the viewport instead, you should do this:
The result is as you'd expect:
A list of all logging functions and their purpose
Logs a debug message to the console or viewport. Useful for quickly switching between log severity
Logs an information message to the console or viewport (Cyan text)
Logs a warning message to the console or viewport (Yellow text)
Logs an error message to the console or viewport (Red text)
Logs a success message to the console or viewport (Green text)
Logs a fatal error message to the console and crash
Logs whether the object specified is valid or not
Quick Log Functions
Logs a yes message to the console or viewport
Logs a no message to the console or viewport
Logs a 'valid' message to the console or viewport
Logs an 'invalid' message to the console or viewport
Logs a hello message to the console or viewport
Data-type Log Functions
Logs a number to the console or viewport
Logs a percentage value to the console or viewport (Just appends a % symbol)
Logs the given bool value to the console or viewport
Logs an FVector value to the console or viewport
Logs a FRotator value to the console or viewport
Logs an FTransform value to the console or viewport (With an option to format for readability purposes)
Logs an FQuat value to the console or viewport
Logs an FMatrix value to the console or viewport
Logs a FLinearColor value to the console or viewport
I need help!
If you are still having any trouble getting this plugin to work, feel free to contact me at email@example.com and report what the issue is.