Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion logfire/_internal/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
from dataclasses import dataclass, field
from pathlib import Path
from threading import RLock, Thread
from typing import TYPE_CHECKING, Any, Callable, Literal, TypedDict
from typing import TYPE_CHECKING, Any, Callable, Literal, TextIO, TypedDict
from urllib.parse import urljoin
from uuid import uuid4

Expand Down Expand Up @@ -141,6 +141,7 @@
class ConsoleOptions:
"""Options for controlling console output."""

output: TextIO | None = None
colors: ConsoleColorsValues = 'auto'
span_style: Literal['simple', 'indented', 'show-parents'] = 'show-parents'
"""How spans are shown in the console."""
Expand Down
10 changes: 9 additions & 1 deletion logfire/_internal/exporters/console.py
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,15 @@ def __init__(
verbose: bool = False,
min_log_level: LevelName = 'info',
) -> None:
self._output = output or sys.stdout
if isinstance(output, str):
if output.lower() == 'stderr':
self._output = sys.stderr
elif output.lower() == 'stdout':
self._output = sys.stdout
else:
self._output = output or sys.stdout
else:
self._output = output or sys.stdout
if colors == 'auto':
force_terminal = None
else:
Expand Down
Loading