question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Allow temporary printing to console

See original GitHub issue

It would be nice to be able to temporarily print to console or print in place. For example, I would like to have output like

================================================
My Verbose Test Cases
================================================

Started Noisy Test Case

and then over time have it print out

Started Noisy Test Case ... Doing setup
Started Noisy Test Case ... Logging In
Started Noisy Test Case ... Entering Data
Started Noisy Test Case ... Submitted
Started Noisy Test Case ... Validating Results
Started Noisy Test Case ... Completed (and I am happy)

and then ends up like

================================================
My Verbose Test Cases
================================================

Started Noisy Test Case ... Completed (and I am happy)         | PASS |
------------------------------------------------------------------------------
My Verbose Test Cases                                                           | PASS |
1 critical test, 1 passed, 0 failed
1 test total, 1 passed, 0 failed
==============================================================================
Output:  C:\sandbox\tooloud\output.xml
Log:     C:\sandbox\tooloud\log.html
Report:  C:\sandbox\tooloud\report.html

Each of these would be a log keyword call; something like

  Log    Entering Data    temporary=${True}
  Log    Completed (and I am happy)\n    in-place=${False}

or some other flag ?!?

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Comments:14 (13 by maintainers)

github_iconTop GitHub Comments

2reactions
HelioGuilherme66commented, Sep 23, 2016

I suppose Ed wants a real time messaging to console, showing only the current log entry which would be end in the final message. This is usually done sending a Carriage Return (CR) char, like ‘\r’, in the beginning of log message. The problem with this is when output is redirected to file/stream not a display.

1reaction
pekkaklarckcommented, Oct 10, 2016

You actually can accomplish this already, at least to some extend, by using Log Console with newlines (\n) and carriage returns (\r) in the test data. Try, for example, running this example with --ConsoleMarkers off option:

*** Test Cases ***
Example
  Log to console    \nFOO    no_newline=True
  Sleep    1
  Log to console    \r------    no_newline=True
  Sleep    1
  Log to console    \rBAR

As you can see if you test the above, there’s a problem that \r doesn’t erase the earlier text but just moves the cursor to the beginning of the line. Thus you end up with BAR--- and not with BAR that you might expect/want. A solution is adding enough spaces at the end of the string. That could be done manually e.g. like ${SPACE * 10}, but perhaps enhancing Log To Console to accept the amount of padding as an optional argument would be better.

Even better than making the padding optional would be accepting the same format specification that Python’s format() function accepts. It would allow configuring padding, alignment, etc. What do others think, should we add format_spec=None argument to Log To Console and perhaps also to Log? Should we even consider adding a separate keywords just for string formatting?

Read more comments on GitHub >

github_iconTop Results From Across the Web

How to make a temporary output - python - Stack Overflow
This simple code will work on python console, but not Ipython console nor Ipython Notebook. def hello(): print 'Hello', time.sleep(2) print ...
Read more >
KB5005652—Manage new Point and Print default driver ...
Right-click Point and Print Restrictions, and then click Edit. In the Point and Print Restrictions dialog, click Enabled. Select the Users can only...
Read more >
Temporarily Continuing Printing with One Ink Cartridge When ...
Make sure that On is selected for Permit temporary one cartridge printing and close the window. Load plain paper or envelopes. Access the...
Read more >
Controlling permissions for temporary security credentials
Create, update, or disable permissions that are assigned to temporary AWS security credentials.
Read more >
How can I force my printer to print in black when ... - Super User
or ask your own question. The Overflow Blog. Let's talk about our favorite terminal tools (Ep. 521).
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found