2

I have a Python script which is designed to run continuously, outputting status messages to the console and to a logfile via logger instances.

This is fine as such.

What I would really love, however, is to condense the most important details into an always-visible "dashboard" at the bottom of the console. Something like this:

Timestamp - Logger info - Minor status update 1
Timestamp - Logger info - Status has changed
Timestamp - Logger info - Status has changed again
Timestamp - Logger info - Successfully opened file
Timestamp - Logger info - Successfully closed file
Timestamp - Logger info - Never gonna give you up
Timestamp - Logger info - Never gonna let you down...
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+ Statistics: Critical errors so far: 0. Processing: 12 units/second.  +
+ Current running time: 44839 seconds. Foos barred: 3. Bars fooed: 11. +                                
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Is there a good way to do this? I haven't been able to find any...

I know it's doable, tools like wget do it all the time:

$ wget http://releases.ubuntu.com/16.04.3/ubuntu-16.04.3-desktop-amd64.iso
--2018-01-06 13:15:57--  http://releases.ubuntu.com/16.04.3/ubuntu-16.04.3-desktop-amd64.iso
Resolving releases.ubuntu.com... 91.189.88.166, 2001:67c:1560:8001::7
Connecting to releases.ubuntu.com|91.189.88.166|:80... connected.
HTTP request sent, awaiting response... 200 OK
Length: 1587609600 (1.5G) [application/x-iso9660-image]
Saving to: ‘ubuntu-16.04.3-desktop-amd64.iso’

ubuntu-16.04.3-desktop-amd64.iso       0%[                                                                      ]   4.64M   857KB/s    eta 42m 12s

I am specifically NOT looking for a web based tool or a graphical interface like most people who seem to be asking about "dashboards"... just a command line interface oriented way to extend what I'm already doing a little.

One way to do this would be with ANSI control characters -- but I am worried that would throw off the logger output (which I want to keep!).

The best solution I've found so far is tqdm which is a pure progress bar... unfortunately I am not trying to "measure progress," just display a few vital statistics persistently at the bottom of the display. And, as sexy as it is, I'm not sure if it will play well with logger!

right2clicky
  • 785
  • 7
  • 14

0 Answers0