robotcodedev / robotcode

RobotFramework support for Visual Studio Code
https://robotcode.io
Apache License 2.0
168 stars 13 forks source link

[ENHANCEMENT] background threads logging #221

Closed softstream-link closed 4 months ago

softstream-link commented 4 months ago

Is your enhancement request related to a problem? Please describe. I am unable to capture logs generated by background threads in the following setup

1) Rust network library links, which starts two threads in the background, one to deal with incoming network traffic and the other to send tcp heartbeats.

2) Python py03 binding over #1, so that a user can initiate a Tcp connection to a peer using Python, rather then rust.

3) Then there is a Robot library that enhances ability to test different Python protocol bindings from #2

It is impossible for me to trouble shoot this setup because of rust background threads. I have read about communication-when-using-threads but it suggests to use another python module to capture/flash background threads logging. It seems to me that to integrate this other module one needs to use it in python code instead of python's standard logging module, however it is impossible for me to do so given that background threads are running in Rust. Also they are not started and stopped by a keyword call and instead they are just running once library is initialized.

Describe the solution you'd like I have looked at both sys.log and debug.log that rust framework exposes for troubleshooting robot library development and I see that most logging is structured around keywords starting and stopping and hence it is logically ignoring all other logging since it would not produce a logical overlay.

However, would it be possible to add another log file that just dumps all logging similar to the way --debugfile works?

Example robot --tracefilewithbackgroundthreads file.log

Describe alternatives you've considered communication-when-using-threads

Additional context N/A

d-biehl commented 4 months ago

I think I understand your concern, but sorry, I'm not sure if RobotCode is the right place for this extension. RobotCode is just an "editor" and only starts robot. Robot Framework Core is responsible for logging, commandline handling and things like that. Maybe you should ask there?

Or am I misunderstanding your request?

softstream-link commented 4 months ago

Sorry, I will repost under correct project