Skip to main content

A lightweight Python utility for file-based logging and persistent state tracking.

Project description

SLinfra

A lightweight Python utility for file-based logging and persistent state tracking.

Overview

  • SLinfra is a minimal Python package designed to help small to medium projects:
  • Keep clean and readable logs
  • Persist application state between runs
  • Avoid heavy logging frameworks
  • It is especially useful for scripts, automation tools, and long-running processes.

Features

  • Simple file-based logger
  • Persistent state storage (JSON-based)
  • Zero external dependencies
  • Easy to integrate into existing projects

Installation

pip install SLinfra

Quick Start

File Logging

from SLinfra.file_logger import FileLogger

logger = FileLogger("app.log")

logger.info("Application started")
logger.warning("Low memory warning")
logger.error("Unexpected error occurred")

This will create (or append to) a log file and store timestamped log messages.

State Tracking

from SLinfra.state_tracker import StateTracker

state = StateTracker("state.json")

state["last_run"] = "2026-01-23T14:00"
state["counter"] = 5
state.save()

This allows your application to persist important values between executions.


Project Structure

SLinfra/
├── SLinfra/
│   ├── __init__.py
│   ├── file_logger.py
│   └── state_tracker.py
├── README.md
├── LICENSE
└── pyproject.toml

Design Goals

  • Keep the API small and intuitive
  • Prefer simplicity over feature overload
  • Avoid external dependencies
  • Be suitable for educational and practical use

Limitations

  • Not thread-safe
  • No log rotation support
  • Designed for small to medium workloads

Roadmap / TODO

  • Add unit tests
  • Add log rotation support
  • Improve type hints and documentation

License

This project is licensed under the MIT License.

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

slinfra-1.0.0.tar.gz (5.4 kB view details)

Uploaded Source

Built Distribution

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

slinfra-1.0.0-py3-none-any.whl (6.1 kB view details)

Uploaded Python 3

File details

Details for the file slinfra-1.0.0.tar.gz.

File metadata

  • Download URL: slinfra-1.0.0.tar.gz
  • Upload date:
  • Size: 5.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.11.15

File hashes

Hashes for slinfra-1.0.0.tar.gz
Algorithm Hash digest
SHA256 c9f0a059e2cc005ad3ec2603e556316e404debf1c915b9385984caf33e8cc5fa
MD5 dfc2a6f19a4b17420ed0c1f55d48c7f2
BLAKE2b-256 82b1faf085274a829d75dfd9c6ef5ef8fac4456176c27dc89a2109040d669af9

See more details on using hashes here.

File details

Details for the file slinfra-1.0.0-py3-none-any.whl.

File metadata

  • Download URL: slinfra-1.0.0-py3-none-any.whl
  • Upload date:
  • Size: 6.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.11.15

File hashes

Hashes for slinfra-1.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 091395c8f6830fda15652b9181a56c6f74c7185c677d4064b35c0662c5b1db64
MD5 63dfc260f19431f50ed598f7df518a24
BLAKE2b-256 be786bef0267c9e7416eabc6580a7fa4ff7a573231144a3918cc5d0e828fe299

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