# Logging system

Published 2024-05-13

The logging system of BlueprintUtilities allows you to get rid of all the print string/print text in your project. Thanks to its centralized management in the project settings, you can control all your Log nodes at once. This new system also allows you to bring the power of C++ logs into your blueprint code, enabling you to create logs compatible with shipping builds without leaving blueprint.

# The Log node

The Log node has two static input pins. The first one is a FGameplayTag selector that represent the LogProfile associated to this node, and the second one is Message pin that contain the string to print.

# Log profiles

To use this system properly you need to create some Log profiles. Log profiles represent a logging behavior that you want to use in your project. Log profiles are represented by a name and a FGameplayTag to allow you to assign them to each of your blueprint nodes with one click!

Attribute Type Description
Name Fname Human readable identifier used to make it simple for you to find a profile in settings. Also used to log it in error/warning's message.
Identifier FGameplayTag Identifier used to bind a log profile to a Log node.
Color FColor Color of the message if the Print to Screen is enabled.
Log Permission EBULogPermission Define where the log node is authorised to log or not. It is based on the who can do more, can do less pattern. It means that if you select Shipping it will print in Shipping, development and editor. To enable log in shipping refer to the Log in shipping section
Verbosity ELogVerbosity The verbosity to use for the message if the Print to Logis enabled.
Print to Log Bool Whether to print or not the message to the logs.
Print to Screen Bool Whether to print or not the message to the screen. Ignored in shipping
Prefix FString String to add before the message to log.
Suffix FString String to add after the message to log.

# Other Settings

Attribute Type Description
Display profile's name in node title Bool If true, the LogProfile name will be display in the node title.
E.g.: Log - MyCustomLogProfile
Should error if no profile selected Bool If true, any Log node with no LogProfile selected will trigger an error during blueprint compilation.
Log node color FColor The default color of the Log node.
Disabled node color FColor The color of the node when his associated LogProfile is disabled.

# Log in shipping

To log in shipping you need to use an Unreal Engine version From source. See : Unreal Engine from source documentation. Then in your project’s Target.cs file add the following lines to force enable the log in shipping.

public class PluginSandboxProjectTarget : TargetRules
	public PluginSandboxProjectTarget(TargetInfo Target) : base(Target)
		Type = TargetType.Game;
		DefaultBuildSettings = BuildSettingsVersion.V4;
		BuildEnvironment = TargetBuildEnvironment.Unique;
		bUseLoggingInShipping = true;

		ExtraModuleNames.AddRange( new string[] { "PluginSandboxProject" } );

# Example

Once you have finished setting up your log profiles, all that's left is to use the Log node in your project. Easy, isn't it? 😜

Powered by Blueprintue.com.