Skip to main content

A easy lightweight robust Python logger.

Project description

🚀 logg_it - Python Logging Utility

logg_it is a versatile logging utility designed to simplify logging for Python applications, featuring powerful stdout capture, automated exception logging, and customizable output.


✨ Features

  • Automatic Exception Logging: Automatically logs exceptions and highlights the problematic line.
  • Stdout Capture: Captures outputs from print() statements.
  • Multiple Outputs: Supports logging to console, file, or both.
  • Flexible Logging Levels: Customizable verbosity (DEBUG, INFO, WARNING, ERROR).
  • Custom Formats: Define custom log message structures.
  • Error-Focused Mode: Optionally logs only errors.
  • Function Tagging: Tags logs with the originating function name.
  • Highlight Errors: Clearly identifies error locations.

📦 Installation

pip install easy-py-logger

⚡ Quick Examples

Decorator Example

from easy-py-logger import logg_it

@logg_it(log_file='logs/example.log', level=logging.DEBUG)
def sample_function():
    print("Hello from function!")
    raise ValueError("Example Exception")

Context Manager Example

with logg_it(log_file='logs/example.log', level=logging.INFO):
    print("Hello from context!")
    1 / 0  # Automatically logs exception

⚙️ Parameters

Parameter Type Default Description
log_file str None Path for file logging. Optional.
level int logging.INFO Logging level.
log_to_console bool True Output logs to console.
log_format str Default format Customizable log format.
log_errors_only bool False If true, logs only errors.

🛠️ Development

Clone repository for local development:

git clone https://github.com/brianvess/easy-py-logger.git
cd your-repo
pip install -e .

📄 Example Log Output

2024-03-10 10:15:00 - INFO - Captured Output: "Hello from function!"
2024-03-10 10:15:01 - ERROR - Exception in [sample_function]: ValueError: Example Exception
🔴 🔥 **sample.py, line 4**

file.name 🌟 Credits

Developed by Brian Vess. If you find this useful, please ⭐ star this repository and contribute! 🚀

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

easy_py_logger-1.0.2.tar.gz (4.6 kB view details)

Uploaded Source

Built Distribution

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

easy_py_logger-1.0.2-py3-none-any.whl (5.0 kB view details)

Uploaded Python 3

File details

Details for the file easy_py_logger-1.0.2.tar.gz.

File metadata

  • Download URL: easy_py_logger-1.0.2.tar.gz
  • Upload date:
  • Size: 4.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.2

File hashes

Hashes for easy_py_logger-1.0.2.tar.gz
Algorithm Hash digest
SHA256 d0c588caa1bd4caf899ac7ca7ae84c61e5eb82bd3e49a122ab3727d6a89803f9
MD5 1cd1a44ed275c49c8af4453773873668
BLAKE2b-256 d24169838de27ddc08ad401686b814a526455f53ddf84b8a8d1a32c8a25d02cf

See more details on using hashes here.

File details

Details for the file easy_py_logger-1.0.2-py3-none-any.whl.

File metadata

  • Download URL: easy_py_logger-1.0.2-py3-none-any.whl
  • Upload date:
  • Size: 5.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.2

File hashes

Hashes for easy_py_logger-1.0.2-py3-none-any.whl
Algorithm Hash digest
SHA256 57fd31e31793e6417df50f648ff232ea090b52e71f90890a886e41ec22f31f47
MD5 2c85fee4f12dfeca2384abd7ce71af80
BLAKE2b-256 053e29efce6414d4d61d86ede68c5524a57abb908441bc9851c401a7c7411464

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