instruktai-python-logger 0.6.0__tar.gz → 0.6.2__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (19) hide show
  1. {instruktai_python_logger-0.6.0 → instruktai_python_logger-0.6.2}/PKG-INFO +1 -1
  2. {instruktai_python_logger-0.6.0 → instruktai_python_logger-0.6.2}/instrukt_ai_logging/logging.py +6 -5
  3. {instruktai_python_logger-0.6.0 → instruktai_python_logger-0.6.2}/instruktai_python_logger.egg-info/PKG-INFO +1 -1
  4. {instruktai_python_logger-0.6.0 → instruktai_python_logger-0.6.2}/pyproject.toml +1 -1
  5. {instruktai_python_logger-0.6.0 → instruktai_python_logger-0.6.2}/tests/test_log_aggregation.py +2 -2
  6. {instruktai_python_logger-0.6.0 → instruktai_python_logger-0.6.2}/README.md +0 -0
  7. {instruktai_python_logger-0.6.0 → instruktai_python_logger-0.6.2}/instrukt_ai_logging/__init__.py +0 -0
  8. {instruktai_python_logger-0.6.0 → instruktai_python_logger-0.6.2}/instrukt_ai_logging/cli.py +0 -0
  9. {instruktai_python_logger-0.6.0 → instruktai_python_logger-0.6.2}/instrukt_ai_logging/install.py +0 -0
  10. {instruktai_python_logger-0.6.0 → instruktai_python_logger-0.6.2}/instrukt_ai_logging/py.typed +0 -0
  11. {instruktai_python_logger-0.6.0 → instruktai_python_logger-0.6.2}/instruktai_python_logger.egg-info/SOURCES.txt +0 -0
  12. {instruktai_python_logger-0.6.0 → instruktai_python_logger-0.6.2}/instruktai_python_logger.egg-info/dependency_links.txt +0 -0
  13. {instruktai_python_logger-0.6.0 → instruktai_python_logger-0.6.2}/instruktai_python_logger.egg-info/entry_points.txt +0 -0
  14. {instruktai_python_logger-0.6.0 → instruktai_python_logger-0.6.2}/instruktai_python_logger.egg-info/top_level.txt +0 -0
  15. {instruktai_python_logger-0.6.0 → instruktai_python_logger-0.6.2}/setup.cfg +0 -0
  16. {instruktai_python_logger-0.6.0 → instruktai_python_logger-0.6.2}/tests/test_cli_follow.py +0 -0
  17. {instruktai_python_logger-0.6.0 → instruktai_python_logger-0.6.2}/tests/test_configure_logging.py +0 -0
  18. {instruktai_python_logger-0.6.0 → instruktai_python_logger-0.6.2}/tests/test_install.py +0 -0
  19. {instruktai_python_logger-0.6.0 → instruktai_python_logger-0.6.2}/tests/test_trace_logging.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: instruktai-python-logger
3
- Version: 0.6.0
3
+ Version: 0.6.2
4
4
  Summary: Centralized logging utilities for Python services.
5
5
  Requires-Python: >=3.11
6
6
  Description-Content-Type: text/markdown
@@ -1,5 +1,6 @@
1
1
  from __future__ import annotations
2
2
 
3
+ import gzip
3
4
  import heapq
4
5
  import logging
5
6
  import os
@@ -378,7 +379,7 @@ def resolve_log_files(app_name: str, *, stems: Iterable[str] | None = None) -> l
378
379
  """Resolve all log files for `app_name`, optionally filtered by stem.
379
380
 
380
381
  Returns every `<something>.log[.suffix]` file in the app's log directory,
381
- excluding compressed rotation siblings (`.gz`). When `stems` is provided,
382
+ including compressed rotation siblings (`.gz`). When `stems` is provided,
382
383
  only files whose stem (basename before the first `.log`) matches an entry
383
384
  are returned. Files are deduplicated and sorted by path.
384
385
 
@@ -404,8 +405,6 @@ def resolve_log_files(app_name: str, *, stems: Iterable[str] | None = None) -> l
404
405
  continue
405
406
  if not path.is_file():
406
407
  continue
407
- if path.name.endswith(".gz"):
408
- continue
409
408
  seen.add(path)
410
409
  result.append(path)
411
410
  return sorted(result)
@@ -613,12 +612,14 @@ def iter_recent_log_lines_merged(files: Iterable[Path], since: timedelta) -> Ite
613
612
  cutoff = _now_utc() - since
614
613
 
615
614
  def _file_stream(path: Path) -> Iterator[tuple[datetime, str]]:
615
+ is_gzip = path.name.endswith(".gz")
616
616
  try:
617
- fb = path.open("rb")
617
+ fb = gzip.open(path, "rb") if is_gzip else path.open("rb")
618
618
  except FileNotFoundError:
619
619
  return
620
620
  try:
621
- offset = _window_start_offset(path, cutoff)
621
+ # Gzip streams cannot use the raw byte probe; stream eligible archives from member start.
622
+ offset = 0 if is_gzip else _window_start_offset(path, cutoff)
622
623
  if offset:
623
624
  fb.seek(offset)
624
625
  fb.readline() # discard the partial line at the seek boundary
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: instruktai-python-logger
3
- Version: 0.6.0
3
+ Version: 0.6.2
4
4
  Summary: Centralized logging utilities for Python services.
5
5
  Requires-Python: >=3.11
6
6
  Description-Content-Type: text/markdown
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
4
4
 
5
5
  [project]
6
6
  name = "instruktai-python-logger"
7
- version = "0.6.0"
7
+ version = "0.6.2"
8
8
  description = "Centralized logging utilities for Python services."
9
9
  readme = "README.md"
10
10
  requires-python = ">=3.11"
@@ -56,11 +56,11 @@ def test_resolve_log_files_default_returns_all_log_files(app_log_dir: Path) -> N
56
56
  _write(app_log_dir / "cron.log", "")
57
57
  _write(app_log_dir / "docs-watch.log", "")
58
58
  _write(app_log_dir / "demo-app.log.1", "")
59
- _write(app_log_dir / "demo-app.log.2.gz", "") # excluded
59
+ _write(app_log_dir / "demo-app.log.2.gz", "")
60
60
 
61
61
  result = resolve_log_files("demo-app")
62
62
  names = sorted(p.name for p in result)
63
- assert names == ["cron.log", "demo-app.log", "demo-app.log.1", "docs-watch.log"]
63
+ assert names == ["cron.log", "demo-app.log", "demo-app.log.1", "demo-app.log.2.gz", "docs-watch.log"]
64
64
 
65
65
 
66
66
  def test_resolve_log_files_with_stems_filters_to_matching_files(app_log_dir: Path) -> None: