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 logg_it 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.3.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.3-py3-none-any.whl (5.0 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: easy_py_logger-1.0.3.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.3.tar.gz
Algorithm Hash digest
SHA256 6d95ba0d3c775c0d9332944c34c554b3f2ade9a01970018fc87f1f280a536a0a
MD5 ab9e0aa9d6c02a1c6969d59240e1c093
BLAKE2b-256 3fae64faf7f66778dc721beb2e97f68e12046d87f2ce27851b79088686f4edd5

See more details on using hashes here.

File details

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

File metadata

  • Download URL: easy_py_logger-1.0.3-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.3-py3-none-any.whl
Algorithm Hash digest
SHA256 b5b5ece6af8994826d50b3f1b7f8f73a4e851f7a4ea003fe87d4cdcc76f8610c
MD5 e3d2fccf6b297ff73a5ddd3d00bbc0a2
BLAKE2b-256 6acf223a634f5b72148dace958db938bf0f06712becf81284f845d8ed8ee032f

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