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.

[BUG] log formating wrapping line numbers

See original GitHub issue

Describe the bug When printing with either Console().log() or using the RichHandler() logging handler line numbers are warped and printed on the next line, see below:

image

To Reproduce

import logging
from rich.logging import RichHandler
from rich.console import Console

logging.basicConfig(level=logging.DEBUG, handlers=[RichHandler()])
logging.error('test')
logging.warning('test')
logging.info('test')
logging.debug('test')
Console().log('test')

Platform The test report is using a the debian:buster image after running the following commands

root@6e16bf7eb9df:/# apt-get update
root@6e16bf7eb9df:/# apt-get install python3 python3-pip vim
root@6e16bf7eb9df:/# pip3 install rich
root@6e16bf7eb9df:/# python3 --version
Python 3.7.3
root@6e16bf7eb9df:/# pip3 list | grep rich
rich              9.11.0 
root@6e16bf7eb9df:/# uname -a 
Linux 6e16bf7eb9df 4.19.0-14-amd64 #1 SMP Debian 4.19.171-2 (2021-01-30) x86_64 GNU/Linux

Diagnose I may ask you to cut and paste the output of the following commands. It may save some time if you do it now.

python -m rich.diagnose python -m rich._windows pip freeze | grep rich

root@6e16bf7eb9df:/# python3 -m rich.diagnose
โ•ญโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€ <class 'rich.console.Console'> โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ•ฎ
โ”‚ A high level console interface.                                                                                                                            โ”‚
โ”‚                                                                                                                                                            โ”‚
โ”‚ โ•ญโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ•ฎ โ”‚
โ”‚ โ”‚ <console width=158 ColorSystem.STANDARD>                                                                                                               โ”‚ โ”‚
โ”‚ โ•ฐโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ•ฏ โ”‚
โ”‚                                                                                                                                                            โ”‚
โ”‚     color_system = 'standard'                                                                                                                              โ”‚
โ”‚         encoding = 'utf-8'                                                                                                                                 โ”‚
โ”‚             file = <_io.TextIOWrapper name='<stdout>' mode='w' encoding='utf-8'>                                                                           โ”‚
โ”‚           height = 16                                                                                                                                      โ”‚
โ”‚ is_dumb_terminal = False                                                                                                                                   โ”‚
โ”‚   is_interactive = True                                                                                                                                    โ”‚
โ”‚       is_jupyter = False                                                                                                                                   โ”‚
โ”‚      is_terminal = True                                                                                                                                    โ”‚
โ”‚   legacy_windows = False                                                                                                                                   โ”‚
โ”‚         no_color = False                                                                                                                                   โ”‚
โ”‚          options = ConsoleOptions(size=ConsoleDimensions(width=158, height=16), legacy_windows=False, min_width=1, max_width=158, is_terminal=True,        โ”‚
โ”‚                    encoding='utf-8', justify=None, overflow=None, no_wrap=False, highlight=None, height=None)                                              โ”‚
โ”‚            quiet = False                                                                                                                                   โ”‚
โ”‚           record = False                                                                                                                                   โ”‚
โ”‚         safe_box = True                                                                                                                                    โ”‚
โ”‚             size = ConsoleDimensions(width=158, height=16)                                                                                                 โ”‚
โ”‚        soft_wrap = False                                                                                                                                   โ”‚
โ”‚           stderr = False                                                                                                                                   โ”‚
โ”‚            style = None                                                                                                                                    โ”‚
โ”‚         tab_size = 8                                                                                                                                       โ”‚
โ”‚            width = 158                                                                                                                                     โ”‚
โ•ฐโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ•ฏ
root@6e16bf7eb9df:/# python3 -m rich._windows
platform="Linux"
WindowsConsoleFeatures(vt=False, truecolor=False)
root@6e16bf7eb9df:/# pip3 freeze | grep rich
rich==9.11.

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:8

github_iconTop GitHub Comments

2reactions
willmcgugancommented, Feb 17, 2021

I think Rich may not be respecting the COLUMNS env var. Iโ€™ll have a fix in the next minor version.

1reaction
willmcgugancommented, Feb 19, 2021

Itโ€™s a bug in your terminal software Iโ€™m afraid. You could try raising an issue with that project.

Read more comments on GitHub >

github_iconTop Results From Across the Web

[BUG] log formating wrapping line numbers #1019 - GitHub
Describe the bug When printing with either Console().log() or using the RichHandler() logging handler line numbers are warped and printed onย ...
Read more >
A proper wrapper for console.log with correct line number?
I would like to wrap console.log for more convenient usage. //isDebug controls the entire site. var isDebug = true; //debugย ...
Read more >
Long line wrapping in Nano - Unix & Linux Stack Exchange
To see the word wrapping style you described, use nano's "soft wrapping": Esc + $ . The Esc + L command you (and...
Read more >
Code macro should wrap long lines | Confluence Server ... - Jira
The wrap up of the long lines caused a problem with a mismatch between the line numbers and the actual line. To solve...
Read more >
[misc] Text Viewer and Editor needs to support word wrap - Bugs
Hello Daniel, Terminology : - Line Wrapping : Word Wrap in the Eclipse jargon. - Context menu : Menu that pops up when...
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