Open-source minimal Rich-based logging solution
Project description
OpenLog
A versatile Python logging utility with rich console output and file logging capabilities.
Features
- Color-coded console output using Rich
- Optional file logging with session-based or persistent log files
- Multiple log levels (INFO, ERROR, WARN, INIT)
- In-memory log storage with flush capability
Installation
pip install openlog
Quick Start
from openlog import Logger
# Basic console-only logger
logger = Logger()
logger.log("This is an info message")
logger.error("Something went wrong")
logger.warn("This is a warning")
logger.init("System initialized")
# Logger with file output
file_logger = Logger(write_to_file=True)
file_logger.log("This message goes to console and file")
# Session-based logging (new log file for each session)
session_logger = Logger(write_to_file=True, session=True)
session_logger.log("Logged with timestamp in filename")
# Store logs in a specific directory
dir_logger = Logger(in_dir=True, write_to_file=True)
dir_logger.log("Logs stored in /logs directory")
# Retrieve logs programmatically
logs = file_logger.flush_logs()
all_logs = file_logger.flush_logs(from_start=True)
Log Levels
log()- General information (blue)error()- Error messages (red)warn()- Warning messages (yellow)init()- Initialization messages (purple)
Configuration
The Logger class accepts the following parameters:
in_dir(bool): Store logs in a '/logs' directorysession(bool): Create unique log files with timestampswrite_to_file(bool): Enable file logging
License
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
openlog-1.0.0.tar.gz
(5.1 kB
view details)
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 openlog-1.0.0.tar.gz.
File metadata
- Download URL: openlog-1.0.0.tar.gz
- Upload date:
- Size: 5.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.12.8
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
8e13c524bd28a85a9522f5034e83c28dea88657c735883ff6095c25de9ca459f
|
|
| MD5 |
c08f9ca75933cc306258bc63f5c95c00
|
|
| BLAKE2b-256 |
c8385eef32a11259f6e32e77d1e3fd692fadb376184c7d003aa15bc56d13ef2c
|
File details
Details for the file openlog-1.0.0-py3-none-any.whl.
File metadata
- Download URL: openlog-1.0.0-py3-none-any.whl
- Upload date:
- Size: 5.1 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.12.8
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
0b6db1acea8edd4559e5a99d7531044780a083f98ffd227aaa42c12f9370ed26
|
|
| MD5 |
707fc58b7a98da5206e7eb6f4e7d512e
|
|
| BLAKE2b-256 |
cd632269727449f3dc6f58446061d31fc9614c7aae57003ecc4987fce21ee75a
|