Skip to content

cli: add thread name to trace logging format #6557

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Merged
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
cli: add thread name to trace logging format
  • Loading branch information
bastimeyer committed Jun 11, 2025
commit 4dd62f2d9b13ba6b9fe8344f2d780336d026c598
2 changes: 1 addition & 1 deletion src/streamlink_cli/argparser.py
Original file line number Diff line number Diff line change
Expand Up @@ -357,7 +357,7 @@ def build_parser():

For verbose levels (`trace` and `all`):

Default is "[{asctime}][{name}][{levelname}] {message}".
Default is "[{asctime}][{threadName}][{name}][{levelname}] {message}".

Otherwise:

Expand Down
2 changes: 1 addition & 1 deletion src/streamlink_cli/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -909,7 +909,7 @@ def setup_logger() -> None:
verbose = level in (logging.getLevelName(logger.TRACE), logging.getLevelName(logger.ALL))
if not fmt:
if verbose:
fmt = "[{asctime}][{name}][{levelname}] {message}"
fmt = "[{asctime}][{threadName}][{name}][{levelname}] {message}"
else:
fmt = "[{name}][{levelname}] {message}"
if not datefmt:
Expand Down
6 changes: 3 additions & 3 deletions tests/cli/main/test_logging.py
Original file line number Diff line number Diff line change
Expand Up @@ -408,14 +408,14 @@ def test_log_current_arguments(
pytest.param(
["--loglevel", "trace"],
TRACE,
"[{asctime}][{name}][{levelname}] {message}",
"[{asctime}][{threadName}][{name}][{levelname}] {message}",
"%H:%M:%S.%f",
id="loglevel=trace",
),
pytest.param(
["--loglevel", "all"],
ALL,
"[{asctime}][{name}][{levelname}] {message}",
"[{asctime}][{threadName}][{name}][{levelname}] {message}",
"%H:%M:%S.%f",
id="loglevel=all",
),
Expand All @@ -429,7 +429,7 @@ def test_log_current_arguments(
pytest.param(
["--loglevel", "all", "--logdateformat", "%Y-%m-%dT%H:%M:%S.%f"],
ALL,
"[{asctime}][{name}][{levelname}] {message}",
"[{asctime}][{threadName}][{name}][{levelname}] {message}",
"%Y-%m-%dT%H:%M:%S.%f",
id="logdateformat",
),
Expand Down