I’m trying to easily see my own log messages in the output log when I run my game. While the category helps it would be much better if I could visually instantly see my logs via a color. Now I know you can use Warning or Error as the Verbosity but while hunting through the code I spotted that the Verbosity has a value of SetColor… I just have no idea how to use it, I spent a good few hours diving through code but got lost
Basically I’d like to set it to a color so that my logs stand out against any real warnings, errors, or system logs that are automatically generated.
Hi GeekyPayback, Thank you for responding. I am specifically intrested in the Unreal Editor log. So SET_WARN_COLOR can change the color, but does it do that for all warnings or just the ones where the warn color is set?
Okay I kind of see what this is doing but there are a few unknowns for me in your example. What is Format? Mainly. I am using a C++ function to write to the log defined as follows:
This is a global function that I plan on adding Debug preprocessors around but basically it is accessable across my entire project because it is declared within my main game’s .h file.
Format in this case means that you are available to adjust your string with specifiers and flags as with C printf() function.
If you like to learn more about it, please go here:
Okay, but I’m still not sure how that solves my original question, which is how do you change the color of the Log text in the log window. I have tried using SET_WARN_COLOR(COLOR_CYAN) but that does not appear to do anything…
That looks exactly what I am trying to do. I actually got the whole net mode working but that looks to be a much better method. I’ll try it out and it if works will be setting this to resolved!
There does not seem to be a mechanism by which to change the color of logged text in the UE Output Window and the docs don’t seem to be accurate.
The docs and online comments would have us believe that this valid…
See: Engine\Source\Runtime\Core\Public\Logging\LogMacros.h
UE_LOG(LogMyCategory, SetColor, TEXT(“%s”), OutputDeviceColor::COLOR_BLUE);
UE_LOG(LogMyCategory, Log, TEXT(“%s”), *message)
UE_LOG(LogMyCategory, SetColor, TEXT(“%s”), OutputDeviceColor::COLOR_NONE);
This macro creates calls to FOutputDevice::Log() and FOutputDevice::LogF() in…
See: Engine\Source\Runtime\Core\Public\Misc\OutputDevice.h
And those calls ultimately land in two places…
Output to the Windows Console. This code seems to honor SetColor…
See: Engine\Source\Runtime\ApplicationCore\Private\Windows\WindowsConsoleOutputDevice2.cpp
See: Engine\Source\Runtime\ApplicationCore\Private\Windows\WindowsConsoleOutputDevice.cpp
Output to the UE Output Window. This code skips SetColor (‘color events’) and auto-selects color for us based on the following logic…
See: Engine\Source\Developer\OutputLog\Private\SOutputLog.cpp
Green - If Category == ‘CmdLog’ (a command is being executed).
Red - Verbosity == ELogVerbosity::Error or the message contains “Error:”.
Yellow - Verbosity == ELogVerbosity::Warnihng or the message contains “Warning:”.
Default (light gray) - Everything else
Logging will also prepend insert text into our message. Examples…
See: Engine\Source\Runtime\Core\Public\Logging\LogVerbosity.h
UE_LOG(LogMyCategory, Detail, TEXT(“My Message …”)) → “LogMyCategory: Detail: My Message …” (Color: Default)
UE_LOG(LogMyCategory, Warning, TEXT(“My Message …”)) → “LogMyCategory: Warning: My Message …” (Color: Yellow)
UE_LOG(LogMyCategory, Error, TEXT(“My Message …”)) → “LogMyCategory: Error: My Message …” (Color: Red)
UE_LOG(LogMyCategory, Fatal, TEXT(“My Message …”)) → “LogMyCategory: Fatal: My Message …” (Color: Red, HALTS EXECUTION, even if logging is disabled.)
UE_LOG(LogMyCategory, Log, TEXT(“My Message …”)) → “LogMyCategory: My Message …” (Color: Default)