Metadata-Version: 2.2
Name: easy-py-logger
Version: 1.0.0
Summary: A lightweight Python decorator for measuring execution time and system resource usage.
Home-page: https://github.com/brianvess/time_it.git
Author: Brian Vess
Author-email: brianvess@icloud.com
Classifier: Programming Language :: Python :: 3
Classifier: License :: OSI Approved :: MIT License
Classifier: Operating System :: OS Independent
Requires-Python: >=3.6
Description-Content-Type: text/markdown
License-File: LICENSE
Dynamic: author
Dynamic: author-email
Dynamic: classifier
Dynamic: description
Dynamic: description-content-type
Dynamic: home-page
Dynamic: requires-python
Dynamic: summary


# 🚀 `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

```bash
pip install easy-logger
```

---

## ⚡ Quick Examples

### Decorator Example

```python
from easy-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

```python
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:

```bash
git clone https://github.com/brianvess/logg_it.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! 🚀
