Skip to content

[BUG] log formating wrapping line numbers #1019

@b4ldr

Description

@b4ldr

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.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions