Skip to main content

simpac-logger

CI PyPI Python License

A Python logger you set up in one line: colored console output by level plus a daily log file under logs/. Standard library only, no dependencies.

from simpac_logger import get_logger

log = get_logger(__name__)

log.debug("detailed information")   # blue
log.info("general information")
log.success("task completed")        # green
log.warning("something to watch")    # orange
log.error("something failed")        # red
log.critical("fatal error")          # bold red

Console:

15:04:12 | DEBUG    | myapp | detailed information
15:04:12 | INFO     | myapp | general information
15:04:12 | SUCCESS  | myapp | task completed
15:04:12 | WARNING  | myapp | something to watch
15:04:12 | ERROR    | myapp | something failed
15:04:12 | CRITICAL | myapp | fatal error

logs/2026-09-07.log (no color codes):

2026-09-07 15:04:12.031 | DEBUG    | myapp | detailed information
2026-09-07 15:04:12.031 | INFO     | myapp | general information
2026-09-07 15:04:12.032 | SUCCESS  | myapp | task completed
...

Installation

pip install simpac-logger

In requirements.txt:

simpac-logger>=0.1.2

To install straight from GitHub instead, for example to try an unreleased commit:

pip install git+https://github.com/simpac-ai-lab/simpac-logger.git@main

Usage

get_logger() arguments

Argument Default Description
name "simpac" Logger name, usually __name__. Calling again with the same name does not add handlers; it only updates the levels
level "DEBUG" Minimum level for console output, as a string or an int
log_dir "logs" Directory for log files, created if missing. Can also be set with the SIMPAC_LOG_DIR environment variable
to_file True False disables the file handler
file_level "DEBUG" Minimum level written to the file
color None None auto-detects; True/False forces the choice
stream sys.stdout Console output stream; pass sys.stderr to switch
# INFO and above on the console, everything in the file, custom directory
log = get_logger("crawler", level="INFO", log_dir="output/logs")

# console only
log = get_logger("quick", to_file=False)

Levels

Level Value Color
DEBUG 10 blue
INFO 20 default
SUCCESS 25 green
WARNING 30 orange
ERROR 40 red
CRITICAL 50 bold white on red

SUCCESS is added by this package. Use level="SUCCESS" to hide INFO messages while keeping success messages visible.

Color detection

  1. NO_COLOR is set: always off
  2. FORCE_COLOR is set: always on
  3. TERM=dumb: off
  4. Jupyter (ipykernel) output stream: on
  5. Otherwise on only when the stream is a TTY, so colors disappear automatically when piped or redirected

On Windows 10 and later the console's ANSI mode is enabled automatically.

Daily files

  • File names follow logs/YYYY-MM-DD.log in local time.
  • A process running past midnight writes subsequent records to the new day's file.
  • Multiple runs on the same day append to the same file.
  • Add logs/ to your .gitignore.

Working with existing logging code

get_logger() returns a subclass of the standard logging.Logger. If a logger with the same name was already created with logging.getLogger(__name__), get_logger(__name__) attaches the handlers and a success() method to that existing logger.

Development

conda create -n simpac-logger python=3.12 -y
conda activate simpac-logger
pip install -e ".[dev]"
pytest
python examples/demo.py

Releasing

  1. Bump version in pyproject.toml and add a section to CHANGELOG.md.

  2. Commit and push to main.

  3. Tag and push the tag:

    git tag -a v0.1.2 -m "simpac-logger 0.1.2"
    git push origin v0.1.2
    

The Publish workflow checks that the tag matches the version, builds the package, uploads it to TestPyPI and then PyPI through Trusted Publishing, and creates a GitHub release with the built files. A version number can never be re-used on PyPI, so fix mistakes with a new patch release.

License

MIT

Download files

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

Source Distribution

simpac_logger-0.1.2.tar.gz (13.2 kB view details)

Uploaded Source

Built Distribution

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

simpac_logger-0.1.2-py3-none-any.whl (9.6 kB view details)

Uploaded Python 3

File details

Details for the file simpac_logger-0.1.2.tar.gz.

File metadata

  • Download URL: simpac_logger-0.1.2.tar.gz
  • Upload date:
  • Size: 13.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/7.0.0 CPython/3.13.14

File hashes

Hashes for simpac_logger-0.1.2.tar.gz
Algorithm Hash digest
SHA256 fedb3ccfa2d108906193ec12f65aa18c64f3b7c5fdccc0b9c935faef91821509
MD5 cf6420640b3df2fc636a3552c654c7b0
BLAKE2b-256 fc0fa58232291a2a7ed0f5a783a884f197ce40bdcd5bdc996f3fd9d8d3867740

See more details on using hashes here.

Provenance

The following attestation bundles were made for simpac_logger-0.1.2.tar.gz:

Publisher: publish.yml on simpac-ai-lab/simpac-logger

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

File details

Details for the file simpac_logger-0.1.2-py3-none-any.whl.

File metadata

  • Download URL: simpac_logger-0.1.2-py3-none-any.whl
  • Upload date:
  • Size: 9.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/7.0.0 CPython/3.13.14

File hashes

Hashes for simpac_logger-0.1.2-py3-none-any.whl
Algorithm Hash digest
SHA256 189966f29e83e8588b6291f040433d54997f077290a9769313fc8dd0c4890c75
MD5 f2ee2d2ffaa0bb84b4318e97beda7803
BLAKE2b-256 0da085970c883ea815b30077dbcc33737a08b2a551434cc34855d527425c3217

See more details on using hashes here.

Provenance

The following attestation bundles were made for simpac_logger-0.1.2-py3-none-any.whl:

Publisher: publish.yml on simpac-ai-lab/simpac-logger

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

Release history Release notifications | RSS feed

0.2.0

2 files

This release

0.1.2 This release

2 files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page