Debug Logging Library Plugin for UE4.22+

The debug log plugin contains a library of debug logging functions that are aimed at improving workflow

and speeding up the development process for both C++ and Blueprint users.

Available on the Unreal Marketplace

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

Standard Functions

Debug Message

Logs a debug message to the console or viewport. Useful for quickly switching between log severity

Info

Logs an information message to the console or viewport (Cyan text)

Warning

Logs a warning message to the console or viewport (Yellow text)

Error

Logs an error message to the console or viewport (Red text)

Success

Logs a success message to the console or viewport (Green text)

Fatal

Logs a fatal error message to the console and crash

Object Validity

Logs whether the object specified is valid or not


Quick Log Functions

Yes

Logs a yes message to the console or viewport

No

Logs a no message to the console or viewport

Valid

Logs a 'valid' message to the console or viewport

Invalid

Logs an 'invalid' message to the console or viewport

Hello

Logs a hello message to the console or viewport


Data-type Log Functions

Number

Logs a number to the console or viewport

Percentage

Logs a percentage value to the console or viewport (Just appends a % symbol)

Bool

Logs the given bool value to the console or viewport

Vector

Logs an FVector value to the console or viewport

Rotator

Logs a FRotator value to the console or viewport

Transform

Logs an FTransform value to the console or viewport (With an option to format for readability purposes)

'

Quaternion

Logs an FQuat value to the console or viewport

Matrix

Logs an FMatrix value to the console or viewport

Color

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 elsaleh78@gmail.com and report what the issue is.