Python Forum
logging values from constantly updating CLI app - Printable Version

+- Python Forum (https://python-forum.io)
+-- Forum: Python Coding (https://python-forum.io/forum-7.html)
+--- Forum: General Coding Help (https://python-forum.io/forum-8.html)
+--- Thread: logging values from constantly updating CLI app (/thread-40801.html)



logging values from constantly updating CLI app - imvirgo - Sep-27-2023

I use rclone to transfer large files to my cloud bucket. The upload command takes a flag that shows a constantly updating transfer speed readout in the terminal window (see image link at bottom). It looks like it updates about once every second.

Strategically what I want to do is make a graph of speed vs elapsed time. Initially I would guess I'd need to write the displayed values to a text or csv. Is there any module that can do this?

Thanks so much

Joe

https://i.imgur.com/fUlmMin.png


RE: logging values from constantly updating CLI app - deanhystad - Sep-27-2023

From what I've read, rclone doesn't produce any output (unless you are doing rclone cat) but it does log to stderr. Try running rclone and redirecting stderr to a file.
Output:
rclone copy /local/path remote:path 2> statistics.txt
Look at the statistics.txt file. Does it contain the information you need?

If the file contains the information you want, there are many things you could do. You could process the file after the rclone command is complete and produce a file that could be used for making plots. Maybe save the data in CSV format so it could be opened in excel, or use plotting tools available in Python. You could read the log information as it is produced and update a live plot. The live plot could be a pretty Matplotlib plot, or it could be a simple ASCII bar chart.