Is there a command in Python to clear the Output log. I find it very useful when debugging to be able to work with a clean log and it’s annoying to have to keep clicking in the window to clear it.
Same here. Did you found the answer?
I think there’s no straightforward way to clear the output log with python. But there are also three different ways to finish this task.
-
If you can modify the engine, expose SOutputLog::OnClearLog and call it from a BlueprintCallable function from python. But I don’t recommend it, it’s actually dangerous.
-
Add a plugin of your own, implement a subclass of FOutputDevice, and regist it with GLog->AddOutputDevice(this), just like OutputLogModule did. Then expose the clear function to python.
-
If you don’t want to add any CPP code at all, you can use third-party modules such as PyAutoGUI to trig the right click and click Clear Log menu item. This is a bit of a hack, but it only use Python ^_^. Here is a small gif I did using the TAPython plug-in.
In fact, I recommend way 2, which does not affect the Engine and is more robust. If you use way 1 and someone abuses this feature, I think you’ll go crazy when you are fixing bugs and can’t find any log.
All ways to actually clear the output logs are kind of complicated so I just spam it with some whitespaces at the script start, works for some of the cases.
for i in range(10):
print(' ')
print('script is loaded')