Skip to main content

Opinionated Python logging

Project description

sysentropy

Opinionated Python logging for the recurring problem of: "I just need a decent logger, why am I formatting timestamps by hand again?"

sysentropy is a small Python library that writes plain logs to disk, colored logs to stdout, and gives you a reusable timestamp helper so you can stop retyping strftime formats you were never going to remember anyway.

How This Repo Happened

This repo exists because writing the same logging setup in every project gets old fast.

One day it is:

  • "I'll just do a tiny logger wrapper."
  • then "I want colors."
  • then "I want a logfile too."
  • then "why is this handler duplicated?"
  • then "what was that timestamp format again?"

At that point the only rational response was obviously to make a library about it.

So this is the result: a lightweight package extracted from that exact cycle of mild annoyance, repeated enough times to become a design requirement. Very noble. Very serious. Entirely unnecessary until it suddenly isn't.

What It Does

  • plain logs on disk
  • colored logs on stdout
  • a small API built on top of the standard logging module
  • a reusable timestamp helper for logfile names and other boring-but-common cases

Features

  • Linux-kernel-inspired level colors for console output
  • separate stdout and file formatters
  • simple get_logger() entrypoint
  • optional directory creation for file logging
  • handler reuse to avoid duplicate output
  • a configuration object that leaves room for future expansion
  • a timestamp() helper that returns YYYYMMDD_HHMMSS

Install

pip install -e .

Quick start

from sysentropy import get_logger, timestamp

logger = get_logger("demo", log_file=f"logs/demo-{timestamp()}.log")

logger.debug("debug message")
logger.info("service started")
logger.warning("disk usage high")
logger.error("request failed")
logger.critical("system halted")

Default output style:

2026-04-01 22:00:00 INFO     : service started
2026-04-01 22:00:00 WARNING  : disk usage high
2026-04-01 22:00:00 ERROR    : request failed

Timestamp Helper

If you only need the timestamp format, import it directly:

from sysentropy import timestamp

filename = f"run-{timestamp()}.log"

It returns values like:

20260401_223735

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

sysentropy-0.1.0.tar.gz (7.2 kB view details)

Uploaded Source

Built Distribution

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

sysentropy-0.1.0-py3-none-any.whl (7.0 kB view details)

Uploaded Python 3

File details

Details for the file sysentropy-0.1.0.tar.gz.

File metadata

  • Download URL: sysentropy-0.1.0.tar.gz
  • Upload date:
  • Size: 7.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.10.12

File hashes

Hashes for sysentropy-0.1.0.tar.gz
Algorithm Hash digest
SHA256 e4c34240b72d2690ec5668cb2a29f18830199fd07a9be94b0949ac57d55bd58a
MD5 d1e7b30cff9d309636cb43edcb054e0e
BLAKE2b-256 a0cfe2d1b027fcb8d8bc3c03ababa0b29b193e223450e14993183250071e4e40

See more details on using hashes here.

File details

Details for the file sysentropy-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: sysentropy-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 7.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.10.12

File hashes

Hashes for sysentropy-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 a343ada3cbf242e0c7ebdb3ea975a6d47a0a1e7111d19e99248c7d886a7cbe52
MD5 07a0c1138af402ea2154de76cc034189
BLAKE2b-256 a5d2f426fbb15b6f97ee50003a6122a95642a2446a51afbce6145c2be915d106

See more details on using hashes here.

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