Simple Global Logging
A simple Python logging extension library that enhances the standard logging functionality with global configuration and stdout capture capabilities.
Features
- Global Logging Setup: Initialize once, use everywhere with standard
import logging - Automatic File Output: Logs saved to timestamped files in
out/directory - Custom Filename Support: Optional custom filenames with automatic append mode
- Standard Output Capture: Capture console output to log files
- pytest Integration: Capture pytest output via conftest.py
- Configurable Timezone: All timestamps in specified timezone (default: UTC)
Installation
pip install simple-global-logging
Quick Start
import simple_global_logging
import logging
# Basic setup
simple_global_logging.setup_logging(verbose=True)
logging.info("This will be logged to file and console")
# With stdout capture
simple_global_logging.setup_logging_with_stdout_capture()
print("This will also be logged")
API Reference
Core Functions
# Basic logging setup
setup_logging(
verbose=False, # Enable DEBUG level if True
base_dir="out", # Log directory
tz=None, # Timezone (default: UTC)
filename=None # Optional custom filename (default: auto-generated)
)
# With stdout capture
setup_logging_with_stdout_capture(
verbose=False,
base_dir="out",
remove_ansi=True, # Remove terminal color codes
tz=None,
filename=None # Optional custom filename (default: auto-generated)
)
# Utility functions
get_logger(name) # Get logger instance
restore_stdout() # Restore original stdout
get_current_log_file() # Get current log file path
get_current_timezone() # Get current timezone
Log File Format
- Location:
out/directory (customizable) - Filename:
- Default:
YYYYMMDD-0000001.log(7-digit sequential number) - Custom: Use specified filename with append mode
- Default:
- Content: Timestamps in specified timezone
Examples
The library includes example scripts in the examples/ directory:
basic_usage.py: Basic logging setupstdout_capture_example.py: Output capturesubmodule.py: Logging from different modulestimezone_example.py: Timezone configurationcustom_filename_example.py: Custom filename and append mode
For pytest integration, see conftest_template.py in the tests/ directory.
Requirements
- Python 3.10 or higher
Development
This library was developed using Cursor, a modern AI-powered IDE.
License
Apache License 2.0
Metadata
Release files for simple-global-logging 0.1.2
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| simple_global_logging-0.1.2.tar.gz | 15.0 kB | With provenance | Details for simple_global_logging-0.1.2.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| simple_global_logging-0.1.2-py3-none-any.whl | Python 3 | none | any | Details for simple_global_logging-0.1.2-py3-none-any.whl |
Total release size: 26.7 kB
Release files / simple_global_logging-0.1.2.tar.gz
| Download URL | simple_global_logging-0.1.2.tar.gz |
|---|---|
| Size | 15.0 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
704a1694f80cbd74f5c321d72976ee36fbd9acf7fd64da06a6bf08c8f203cd4b
|
|
BLAKE2b-256 checksum How to use checksums |
351c52b843216ab88317830660b710b76601de33aee746ba7ccaa2f1b075e0db
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.12.9
|
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 16, 2025.
Transparency logRelease files / simple_global_logging-0.1.2-py3-none-any.whl
| Download URL | simple_global_logging-0.1.2-py3-none-any.whl |
|---|---|
| Size | 11.6 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
1c9701c4afd64493902b881ae382c014907d9db9dc63401c91f71abc3eef8b4a
|
|
BLAKE2b-256 checksum How to use checksums |
fda68b5a442f6fbcd19ddc1707fad8496d479f573cc010c20afc63ef46a58722
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.12.9
|
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 16, 2025.
Transparency logSecurity for simple-global-logging 0.1.2
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.
Attestation for simple_global_logging-0.1.2.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 16, 2025.
Transparency logA 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.