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
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file slinfra-0.3.0.tar.gz.
File metadata
- Download URL: slinfra-0.3.0.tar.gz
- Upload date:
- Size: 4.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.11.15
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
6112d9f00448e44e4daffc2ddda116d40fe6aadb395f3c3077ef99f69f074fa4
|
|
| MD5 |
2dca91b563a00f6658912efae0fd47f7
|
|
| BLAKE2b-256 |
5f8e64f641344bbe8e06928212b0afb9ea330b84ef2174a74e8d45ee27598bee
|
File details
Details for the file slinfra-0.3.0-py3-none-any.whl.
File metadata
- Download URL: slinfra-0.3.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.11.15
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
8fc5b750d957fd78129de29269e980e8c3ee48c3064ede72f64f12ee5ccc5cde
|
|
| MD5 |
3e3de82c2f0ca233d43e6e81700dc2af
|
|
| BLAKE2b-256 |
e79e2686339e549948fc46eb894dd625529b0284620f9b4995b692e6b19fd283
|