alan-turing-institute / data-safe-haven

https://data-safe-haven.readthedocs.io
BSD 3-Clause "New" or "Revised" License
57 stars 15 forks source link

from_ansi strips colours #2112

Closed jemrobinson closed 1 month ago

jemrobinson commented 1 month ago

:white_check_mark: Checklist

:computer: System information

:package: Packages

List of packages ```none Paste list of packages here ```

:no_entry_sign: Describe the problem

The from_ansi function actually strips ANSI information from text. It converts str -> rich.Text and then passes this to logger.info. However, at some point in the logger handling chain, the rich.Text object is converted to a string, stripping the markup information before it reaches the RichHandler.

Either passing the ANSI-formatted string directly, or converting this to Rich markup would avoid this problem.

Screenshot 2024-08-08 at 16 06 05

:deciduous_tree: Log messages

Relevant log messages ```none Your log details here ```

:recycle: To reproduce

Deploy an SRE and observe the lack of colour in the Pulumi output.

jemrobinson commented 1 month ago

Closed by #2113.