Skip to main content

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' directory
  • session (bool): Create unique log files with timestamps
  • write_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)

Uploaded Source

Built Distribution

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

openlog-1.0.0-py3-none-any.whl (5.1 kB view details)

Uploaded Python 3

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

Hashes for openlog-1.0.0.tar.gz
Algorithm Hash digest
SHA256 8e13c524bd28a85a9522f5034e83c28dea88657c735883ff6095c25de9ca459f
MD5 c08f9ca75933cc306258bc63f5c95c00
BLAKE2b-256 c8385eef32a11259f6e32e77d1e3fd692fadb376184c7d003aa15bc56d13ef2c

See more details on using hashes here.

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

Hashes for openlog-1.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 0b6db1acea8edd4559e5a99d7531044780a083f98ffd227aaa42c12f9370ed26
MD5 707fc58b7a98da5206e7eb6f4e7d512e
BLAKE2b-256 cd632269727449f3dc6f58446061d31fc9614c7aae57003ecc4987fce21ee75a

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