Log code execution errors

Hi there, I was looking into ways to log executions from with-in the Theia IDE and catch all errors from the terminal for further process, is there any such example already implemented from where I can see and understand how to implement the logger module? Do I need to override the run button functionality to do that or should I create a custom extension to achieve the desired functionality?

By run button I mean, this following button
image

Thanks in advance!