Skip to content

Commit

Permalink
Add check for the texts that should be printed in console
Browse files Browse the repository at this point in the history
  • Loading branch information
hramezani committed Jan 29, 2025
1 parent 52dc65f commit ece0f1d
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions logfire/_internal/exporters/console.py
Original file line number Diff line number Diff line change
Expand Up @@ -117,10 +117,11 @@ def _print_span(self, span: ReadableSpan, indent: int = 0):
if details_parts:
parts += [('\n', '')] + details_parts

print(parts)
if self._console:
self._console.print(Text.assemble(*parts))
self._console.print(Text.assemble(*[(text, style) for text, style in parts if isinstance(text, str)])) # type: ignore
else:
print(''.join(text for text, _style in parts), file=self._output)
print(''.join(text for text, _style in parts if isinstance(text, str)), file=self._output) # type: ignore

# This uses a separate system for color vs no-color because it's not simple text:
# in the rich case it uses syntax highlighting and columns for layout.
Expand Down

0 comments on commit ece0f1d

Please sign in to comment.