Skip to main content

Simplified Logger

A lightweight Python logging wrapper that simplifies the use of Python's standard logging module. This library provides an easy-to-use interface for logging to both console and files with minimal configuration.

Features

  • Simple API: Clean and intuitive methods for all log levels
  • File & Console Logging: Support for both file and console handlers
  • Formatted Output: Pre-configured formatting with timestamps and log levels
  • Auto Directory Creation: Automatically creates log directories if they don't exist
  • Duplicate Prevention: Built-in checks to prevent duplicate handler initialization
  • Multiple Log Levels: Support for INFO, DEBUG, WARNING, ERROR, and CRITICAL levels

Installation

Clone the repository or copy the lib/standard-logger.py file to your project:

pip install simplified-logging

Or simply download the file and place it in your project directory.

Usage

Standard Logging (Zero-Dependency)

The StandardLogger (aliased as Logger for backward compatibility) uses Python's built-in logging module.

from std_log import StandardLogger

logger = StandardLogger(name="app.log", dir="logs")
logger.console_handler()
logger.file_handler()

logger.info("Application started")

Structured Logging (JSON)

The StructLogger uses structlog to output machine-readable JSON logs, perfect for cloud log aggregators.

from std_log import StructLogger

logger = StructLogger(name="app.json", dir="logs")
logger.info("user_login", user_id=123, ip="1.2.3.4")

Serilog-Style Logging

The SeriLogger uses serilog-python for a modern, structured logging experience inspired by .NET's Serilog.

from std_log import SeriLogger

logger = SeriLogger(name="serilog")
logger.info("Process completed", duration_ms=450, status="success")

API Reference

Logger Class

__init__(name: str, dir: str)

Initialize a new logger instance.

  • name: Name of the log file (e.g., "app.log")
  • dir: Directory name where logs will be stored (prefix with '.' automatically added)

console_handler() -> None

Adds a console handler to output logs to the terminal/console.

file_handler() -> None

Adds a file handler to write logs to a file. Creates the directory if it doesn't exist.

info(message: str)

Logs an informational message (INFO level).

debug(message: str)

Logs a debug message (DEBUG level). Useful for detailed diagnostic information.

warn(message: str)

Logs a warning message (WARNING level).

error(message: str)

Logs an error message (ERROR level).

critical(message: str)

Logs a critical message (CRITICAL level). For severe errors that may cause application failure.

Log Format

The logger uses the following format for all messages:

%(asctime)s - %(levelname)-8s - %(name)s - %(message)s

Example output:

2026-03-09 10:30:45,123 - INFO     - app.log - Application started successfully
2026-03-09 10:30:46,456 - WARNING  - app.log - This is a warning message
2026-03-09 10:30:47,789 - ERROR    - app.log - An error occurred

Requirements

  • Python 3.10+
  • structlog (required for StructLogger)
  • serilog-python (required for SeriLogger)

Project Structure

simplified-logger/
├── .git/
├── .github/
├── .vscode/
├── LICENCE
├── README.md
├── pyproject.toml
└── src/
    └── std_log/
        ├── __init__.py
        ├── std_log.py
        └── std_log.pyi

License

Licence

Author

krigjo25 - krigjo25@gmail.com

Support

If you encounter any issues or have questions, please open an issue on the GitHub repository.

Metadata

Release files for simplified-logging 1.3

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for simplified-logging 1.3
File Size Uploaded Provenance Actions
simplified_logging-1.3.tar.gz 6.7 kB With provenance Details for simplified_logging-1.3.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for simplified-logging 1.3
File Interpreter ABI Platform Actions
simplified_logging-1.3-py3-none-any.whl Python 3 none any Details for simplified_logging-1.3-py3-none-any.whl

Total release size: 13.5 kB

Release files / simplified_logging-1.3.tar.gz

Download URL simplified_logging-1.3.tar.gz
Size 6.7 kB
Tags Source
SHA-256 checksum
How to use checksums
b577672af2a8fc4f8125367958989b6ead99f79ae91bbbd7647ef634afbf3d0d
BLAKE2b-256 checksum
How to use checksums
7e48a197a483c9bfea0b42082e9f01afc81974d0e883bdbb4a025a43864e9e77
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.12

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Jun 2, 2026.

Transparency log

Release files / simplified_logging-1.3-py3-none-any.whl

Download URL simplified_logging-1.3-py3-none-any.whl
Size 6.8 kB
Tags Python 3
SHA-256 checksum
How to use checksums
293b495489105e99c83742e8d081e24a7c1cd3ec31fac1347b0010e112497e87
BLAKE2b-256 checksum
How to use checksums
643a1badedc8d70f1538410b2f049d0a5cac8b5c6d7cbe28f6a72dec41457d14
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.12

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Jun 2, 2026.

Transparency log

Security for simplified-logging 1.3

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

Full provenance

Both files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for simplified_logging-1.3.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Jun 2, 2026.

Transparency log

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

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