Unreal Engine C++: log categories
// MyLogCategory.h // MYGAME_API will be needed if the category is to be used outside the module. MYGAME_API DECLARE_LOG_CATEGORY_EXTERN(LogMyGameLog, Log, All); //MyLogCategory.cpp DEFINE_LOG_CATEGORY(LogMyGameLog);
Include the above header where you want to use the category.
#include "MyLogCategory.h"
// you can now use your category:
{
UE_LOG(LogMyGame, Display, Text("a message"));
}
If used in another module, set up the dependency to the category’s module. for instance in MyOtherModule.Build.cs:
PublicDependencyModuleNames.AddRange(new string[] { "Core", "MyGame" });
No comments