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.
I posted this on answer hub but recieved no aid, so If you have an idea please post it below and/or on the answer hub topic
Well GeekyPayback stated in the answer hub that to change the Warn color you can use a macro called
SET_WARN_COLOR(COLOR_CYAN)
I assume there is a similar color such as
SET_ERROR_COLOR()
and
SET_LOG_COLOR()
Unfortunately I cannot test those assumptions at the moment. I do have a question about if that sets the Warn color for ALL warnings or just the warnings logged since you changed the color. I would really love a method to set color by category rather than the entire warning or error verbosity. Or maybe a way to define your own verbosity (though by verbosity doesn’t make much since, by line or category would be ideal).
I recently tried to implement this in my own project following your example, but was unable to get a color for the log produced when running an executable with -log, or in the output log of the editor. Has this method stopped working all around? Did it ever work?
I was being impatient and wanted to reduce compile time, so I had placed the macro defines in a .cpp file. The code was lifted directly from the wiki, which did nothing to lead me to believe it would work if pasted into a .cpp file… so totally my bad. I have since placed it in the project header and it functions as intended.
Perhaps this can serve as a warning to others as impatient as myself. Thanks so much for the snippet, its gonna be super helpful.
I did some testing. It doesn’t appear to work in 4.24.
Code is in the header file. #include “Misc/OutputDevice.h” as well (which also contains instructions on use)
Building colour table in the format: RGBB, e.g. bright red: 1001, dark red: 1000
Also just tried COLOR_PURPLE (and again with the namespace, fetches the colour code fine in both cases)
Tried both SET_WARN_COLOR(COLOR_PURPLE) and its actual command: UE_LOG(LogTemp, SetColor, TEXT("%s"), COLOR_PURPLE); (original logspace isn’t LogTemp though, it’s LogHAL)
Tried Log, Warning and Error log channels
Nothing. Bit annoyed, like you guys I can’t read red on grey, and it would have been nice to be able to print to the log in a similar way that we can print colour strings to the HUD.
I started using cygwin and multitail to achieve colored logs. It takes a bit more doing because you have to regex to get the coloring you want, but you get exactly what you want.
This is the multitail ue4 colorscheme I have so far: (drop this in /etc/multitail.conf)
colorscheme:ue4
# Pickout Specials Words etc.
cs_re:87:LogAbilitySystem
cs_re:99:Task
cs_re:99:Ability
cs_re:9:Fatal
cs_re:9:Error
cs_re:3:Warning
cs_re:11:Display
cs_re:82:Verbose
cs_re:81:VeryVerbose
# General Color Formatting
cs_re:2:^\[0-9]*.[0-9]*.[0-9]*-[0-9]*.[0-9]*.[0-9]*:[0-9]*]
cs_re_s:3:^\[0-9]*.[0-9]*.[0-9]*-[0-9]*.[0-9]*.[0-9]*:[0-9]*](\...*\])
cs_re_s:4:^\[0-9]*.[0-9]*.[0-9]*-[0-9]*.[0-9]*.[0-9]*:[0-9]*]\...*\](^ ]*)
cs_re_s:6:^\[0-9]*.[0-9]*.[0-9]*-[0-9]*.[0-9]*.[0-9]*:[0-9]*]\...*\]^ ]*(.*)