Logging with custom color

I’d like to log a message to the Output Window in the editor. I know I can use the colors: grey, yellow and red. I always run my project from Visual Studio so the custom warning colors (afaik) won’t work. I do not seem to have access to the command-color (green). I there really no way to make my own logs stand out more other than making them a warning/error?

This is what I have now:

// Note that logging it as a warning is the only way to not make it grey or red... I have no access to the command-color (green) and no option to use a custom color.
#define LOG(Format, ...) \
{ \
 FString Msg = FString::Printf(TEXT(Format), ##__VA_ARGS__); \
 GEngine->AddOnScreenDebugMessage(-1, 5.0f, FColor::Blue, FString::Printf(TEXT("%s%s() : %s"), NETMODE_WORLD, FUNC_NAME, *Msg));\
 UE_LOG(LogTemp, Warning, TEXT("[%s%s()] %s"), NETMODE_WORLD, FUNC_NAME, *Msg);\
}

The AddOnScreenDebugMessage() obviously works but the UE_LOG() can only be grey w/o resorting to a warning/error.

Hey there, you have:

SET_WARN_COLOR(COLOR_CYAN);

// UE_LOG here

CLEAR_WARN_COLOR();

You can use this example as reference.

That only works when you run the editor with command options. That’s why I specifically mentioned that I run it through VS. Unless that would also work, somehow? Because that is among others what I tried before the OP and it does not work. And I read somewhere else that it is not intended to be used that way plus it requires command lines options.

Did you ever find out?

No I didn’t.

So, in LogVerbosity.h I just found

SetColor		= 0x40, // not actually a verbosity, used to set the color of an output device 

after searching for that, I found this comment in MacNativeFeedbackContext.cpp (same commend also in WindowsConsoleOutputDevice.cpp):

// here we can change the color of the text to display, it's in the format:
			// ForegroundRed | ForegroundGreen | ForegroundBlue | ForegroundBright | BackgroundRed | BackgroundGreen | BackgroundBlue | BackgroundBright
			// where each value is either 0 or 1 (can leave off trailing 0's), so
			// blue on bright yellow is "00101101" and red on black is "1"
			// An empty string reverts to the normal gray on black
if (Verbosity == ELogVerbosity::SetColor)
		{...

Maybe this helps someone to figure something out :wink: