Metadata-Version: 2.4
Name: logita
Version: 1.3.0
Summary: A simple and colorful logging utility for console output with support for context manager.
Author: Jose Luis Coyotzi
Author-email: Jose Luis Coyotzi <jlci811122@gmail.com>
License: MIT
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.6
Classifier: Programming Language :: Python :: 3.7
Classifier: Programming Language :: Python :: 3.8
Classifier: Programming Language :: Python :: 3.9
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Operating System :: OS Independent
Classifier: License :: OSI Approved :: MIT License
Classifier: Intended Audience :: Developers
Classifier: Topic :: Software Development :: Libraries :: Python Modules
Classifier: Typing :: Typed
Requires-Python: >=3.6
Description-Content-Type: text/markdown
License-File: LICENSE
Requires-Dist: colorama>=0.4.6
Dynamic: author
Dynamic: license-file
Dynamic: requires-python

# Logita

Logita is a lightweight and customizable Python logging utility focused on improving developer experience in the console, with optional file logging support. It provides colored output, structured log levels, and a simple API designed primarily for CLI tools, scripts, and developer-facing applications.

## Features

- Timestamped log messages printed directly to the console.
- Optional colored output using `colorama`.
- Supported log levels:
  - debug
  - info
  - success (custom semantic level)
  - warning
  - error
  - critical
  - exception (with full traceback support)
- Optional file logging using Python's built-in `logging` module.
- Ability to print logs with or without a newline (useful for progress output).
- Context manager support (`with` statement) for automatic exception capturing.
- No dependency on global logging configuration.

## Installation

```bash
pip install logita
```

Ensure `colorama` is installed:

```bash
pip install colorama
```

## Basic Usage

```python
from logita import Logita

with Logita(use_colors=True) as log:
    log.info("Informational message")
    log.success("Operation completed successfully")
    log.warning("Potential issue detected")
    log.error("An error occurred")
    log.debug("Processing...", line=False)
    log.debug(" done")
    log.critical("Critical failure")
    log.exception("Unhandled exception")
```

## File Logging

Logita can optionally persist logs to a file while still printing to the console:

```python
log = Logita(use_colors=True, log_file="app.log")
log.info("This message appears in the console and in the log file")
```

File logs use the following format:

```
[YYYY-MM-DD HH:MM:SS] [LEVEL] message
```

## Constructor Parameters

- `use_colors` (bool, default: True)
  Enables or disables colored console output.

- `log_file` (str | None, default: None)
  Path to a file where logs will be written using the standard `logging` module.

## Design Notes

- Console output is handled explicitly via `print` for full control over formatting and colors.
- File logging is isolated and handled by an internal `logging.Logger` instance.
- Logita is best suited for scripts, CLI tools, and developer utilities.
- It is not designed to replace full-featured logging frameworks in highly concurrent or distributed systems.

## License

MIT License
