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-0.2.0.tar.gz (4.1 kB view details)

Uploaded Source

Built Distribution

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

slinfra-0.2.0-py3-none-any.whl (4.9 kB view details)

Uploaded Python 3

File details

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

File metadata

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

File hashes

Hashes for slinfra-0.2.0.tar.gz
Algorithm Hash digest
SHA256 f4c77862a2b563ca9c79e0ebf6f53d0815137b152fac6a30ca82257466052568
MD5 542090c28fa98464347bca4f70524c87
BLAKE2b-256 c28cbc165b61ed71dc5c40ea822c104262d91726b2ad0c995bd49a6688470088

See more details on using hashes here.

File details

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

File metadata

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

File hashes

Hashes for slinfra-0.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 d0c15a1d67a9eb19277e8b467ef43f46b57f047f2fb38baad0fee63aa5d1a772
MD5 58b75119dae87d4e128fe0e99a285735
BLAKE2b-256 6b47b299c96f24c8636658c1c4a26e187d75b90b07055f9d7d9fb41a6622ec08

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