Skip to main content

Logging utilities for the SciTeX ecosystem

Project description

scitex-logging

SciTeX

Logging utilities for SciTeX — SUCCESS/FAIL log levels, typed exception hierarchy, Tee context-manager.

Full Documentation · uv pip install scitex-logging[all]

pypi python docs

tests install-check cov


Problem and Solution

# Problem Solution
1 stdlib logging has only 5 levels -- experiment scripts want a distinct SUCCESS and FAIL signal that stands out in grep SUCCESS + FAIL levels added -- color-coded, level-aware handlers; drop-in compatible with getLogger(__name__)
2 raise ValueError("shape mismatch") loses context -- every package rolls its own exception hierarchy 30+ typed exceptions -- SciTeXError root + ShapeError, DTypeError, ConfigKeyError, PDFDownloadError, ...; isinstance(e, DataError) catches the whole class
3 Tee stdout-to-file is a recipe -- every script implements it differently Tee("run.log") context-manager -- one import, no boilerplate

Installation

pip install scitex-logging

1 Interfaces

Python API
import scitex_logging

# Configure logging
scitex_logging.configure(level=scitex_logging.INFO, enable_file=True)

# Get a logger
import logging
logger = logging.getLogger(__name__)
logger.info("Hello from SciTeX logging")

# Tee stdout/stderr to log files
import sys
sys.stdout, sys.stderr = scitex_logging.tee(sys)

# Custom error classes
from scitex_logging import SciTeXError, SaveError

# Warning utilities
from scitex_logging import warn_deprecated, warn_performance

# LLM session log parsing
log = scitex_logging.llm.load("session.jsonl")
log.summary()
log.render("out.html")

Architecture

scitex_logging/
├── _config.py            ← `configure()` entry point + level registration
├── _levels.py            ← SUCCESS / FAIL custom log levels
├── _tee.py               ← stdout/stderr Tee context-manager
├── exceptions/           ← 30+ typed `SciTeXError` subclasses
│   ├── _data.py          ← ShapeError, DTypeError, ...
│   ├── _config.py        ← ConfigKeyError, ...
│   └── _network.py       ← PDFDownloadError, ...
├── warnings/             ← `warn_deprecated`, `warn_performance`
└── llm/                  ← Claude / LLM session-log parsers

Demo

flowchart LR
    A[script.py] -->|getLogger| B[scitex_logging]
    B --> C{level}
    C -->|SUCCESS| D[green log + Tee → run.log]
    C -->|FAIL| E[red log + Tee → run.log]
    C -->|ERROR| F[typed SciTeXError raised]
import logging, scitex_logging as sxl

sxl.configure(level=sxl.INFO, enable_file=True)
log = logging.getLogger(__name__)

log.success("model converged")    # green
log.fail("validation failed")     # red, distinct from ERROR
2026-05-07 12:00:00 SUCCESS  model converged
2026-05-07 12:00:01 FAIL     validation failed

Part of SciTeX

scitex-logging is part of SciTeX. Install via the umbrella with pip install scitex[logging] to use as scitex.logging (Python).

Four Freedoms for Research

  1. The freedom to run your research anywhere — your machine, your terms.
  2. The freedom to study how every step works — from raw data to final manuscript.
  3. The freedom to redistribute your workflows, not just your papers.
  4. The freedom to modify any module and share improvements with the community.

AGPL-3.0 — because we believe research infrastructure deserves the same freedoms as the software it runs on.

License

AGPL-3.0-only — see LICENSE.


SciTeX

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

scitex_logging-0.1.7.tar.gz (467.7 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

scitex_logging-0.1.7-py3-none-any.whl (74.3 kB view details)

Uploaded Python 3

File details

Details for the file scitex_logging-0.1.7.tar.gz.

File metadata

  • Download URL: scitex_logging-0.1.7.tar.gz
  • Upload date:
  • Size: 467.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for scitex_logging-0.1.7.tar.gz
Algorithm Hash digest
SHA256 f3b09e6cbfecd5dea78d6e4183cfd3194059b5b233a699385cc78becb365109b
MD5 e414c25e54f5e462ada52589d626cedd
BLAKE2b-256 39223430a0139d23f9680d7f2379314b4fbade3ec8c736682f8a80e6cb1ae4a2

See more details on using hashes here.

Provenance

The following attestation bundles were made for scitex_logging-0.1.7.tar.gz:

Publisher: pypi-publish-and-github-release-on-tag.yml on ywatanabe1989/scitex-logging

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file scitex_logging-0.1.7-py3-none-any.whl.

File metadata

  • Download URL: scitex_logging-0.1.7-py3-none-any.whl
  • Upload date:
  • Size: 74.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for scitex_logging-0.1.7-py3-none-any.whl
Algorithm Hash digest
SHA256 e0027bb90fbbc973eec13df52803ad2eeb5944a9a9f487869589c03a9b5c8bd3
MD5 bef6e590e379598e3225189b0764b0e2
BLAKE2b-256 f9a0921616a09833feecbb9ec2bd424f0f41338f711d42857d85b739a2b36c39

See more details on using hashes here.

Provenance

The following attestation bundles were made for scitex_logging-0.1.7-py3-none-any.whl:

Publisher: pypi-publish-and-github-release-on-tag.yml on ywatanabe1989/scitex-logging

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page