Hi guys, I’ve been trying to set up custom logging and I’ve been trying to use this as a guide:
After over a year in maintenance mode, the official Unreal Engine Wiki is now permanently offline. These resources now live on a new community-run Unreal Engine Community Wiki — ue4community.wiki! You will be able to find content from the official...
Reading time: 1 mins 🕑
Likes: 14 ❤
The issue is this doesn’t work for me. I’ve tried putting the custom category in like this:
// Copyright 1998-2014 Epic Games, Inc. All Rights Reserved.
DECLARE_LOG_CATEGORY_EXTERN(CombatDecisions, Log, All)
DECLARE_LOG_CATEGORY_EXTERN(CombatCombos, Log, All)
This fails and the complier has no idea what it is. I’ve also tried putting it straight into the .h of the classes that will be using it and same errors.
Could someone show me an example of exactly where it needs to be in code?
I also need to use DEFINE_LOG_CATEGORY within the .cpp so that would be great to know as well?
They wiki page you linked describes where the code goes, so they must have updated it since this question was asked… This is an older post, but I’ll quickly answer here in case people find this through a search like me:
If you project is called MyGame, do the following:
DECLARE_LOG_CATEGORY_EXTERN(MyLogCat, Log, All);
and in MyGame.cpp
To add onto this, if you’ve defined custom logs, you need to include the base header to use them
What is the “base header”? Like MyProject.h?