Metadata-Version: 2.3
Name: loghero
Version: 1.0.0
Summary: Simple app for log some generic infos on db in a structured way
Project-URL: Homepage, https://github.com/rh363/log-hero
Project-URL: Issues, https://github.com/rh363/log-hero/issues
License: This is free and unencumbered software released into the public domain.
        
        Anyone is free to copy, modify, publish, use, compile, sell, or
        distribute this software, either in source code form or as a compiled
        binary, for any purpose, commercial or non-commercial, and by any
        means.
        
        In jurisdictions that recognize copyright laws, the author or authors
        of this software dedicate any and all copyright interest in the
        software to the public domain. We make this dedication for the benefit
        of the public at large and to the detriment of our heirs and
        successors. We intend this dedication to be an overt act of
        relinquishment in perpetuity of all present and future rights to this
        software under copyright law.
        
        THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
        EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
        MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
        IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR
        OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
        ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
        OTHER DEALINGS IN THE SOFTWARE.
        
        For more information, please refer to <https://unlicense.org>
Classifier: Environment :: Web Environment
Classifier: Intended Audience :: Developers
Classifier: License :: OSI Approved :: The Unlicense (Unlicense)
Classifier: Operating System :: OS Independent
Classifier: Programming Language :: Python :: 3 :: Only
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: Programming Language :: Python :: 3.12
Classifier: Topic :: Software Development :: Libraries :: Application Frameworks
Classifier: Topic :: Software Development :: Libraries :: Python Modules
Requires-Python: >=3.0
Requires-Dist: asgiref==3.8.1
Requires-Dist: certifi==2024.8.30
Requires-Dist: charset-normalizer==3.4.0
Requires-Dist: django>=4.2
Requires-Dist: hostip-client==1.0.3
Requires-Dist: idna==3.10
Requires-Dist: requests==2.32.3
Requires-Dist: sqlparse==0.5.2
Requires-Dist: urllib3==2.2.3
Description-Content-Type: text/markdown

# LogHero

LogHero is a simple Django application designed to log generic information in the database in a structured way. 
It provides a convenient way to record and manage logs with customizable severity and status levels.

## Project Overview

- **Name**: LogHero
- **Version**: 1.0.0
- **Description**: A Django app for structured logging of various actions and information.
- **License**: OSI Approved :: The Unlicense
- **Homepage**: [LogHero on GitHub](https://github.com/rh363/LogHero)
- **Issues**: [Issue Tracker](https://github.com/rh363/LogHero/issues)

## Features

- **Logging**: Tracks actions, actors, target entities, severities, statuses, and contextual metadata.
- **Admin Integration**: Provides an admin interface for log monitoring and filtering.
- **Enums for Choices**: Uses Django's `TextChoices` for handling log statuses and severities.
- **Location auto discovery**: LogHero use [hostip_client](https://github.com/rh363/hostip_client) for get ip location from [hostip.info](https://hostip.info/).

## Prerequisites

- Python 3.8 or higher
- Django 4.2 or higher

## Installation

To install LogHero, follow these steps:

1. Clone the repository:
   ```bash
   pip install loghero
   ```

2. Add `loghero` to your `INSTALLED_APPS` in your Django project's `settings.py`:
   ```python
   INSTALLED_APPS = [
       ...
       'loghero',
       ...
   ]
   ```

3. Run database migrations:
   ```bash
   python manage.py migrate
   ```

## Usage

### Logging Actions

Use the `add_log` function to create a new log entry:

```python
from loghero.models import Severity, Status
from loghero import add_log, get_client_ip

ip = get_client_ip(request) # django http request optional
add_log(
    actor='John Doe',
    action='Login Attempt',
    severity=Severity.INFO,
    status=Status.SUCCESS,
    target='user@example.com',
    target_type='User',
    ip_address=ip, #optional
)
```

### Admin Interface

Access the admin panel to view and filter log entries. Customize log visibility using admin configurations in `admin.py`:

- Display crucial log attributes.
- Filter logs by severity and status.
- Search through logs using predefined fields.

## Contributing

If you wish to contribute to LogHero, feel free to open issues or submit pull requests via the GitHub repository linked above.

## License

This project is licensed under the terms of [The Unlicense](LICENSE).

## Dependencies

The project depends on the following packages:

- Django
- ASGIRef
- Certifi
- Charset Normalizer
- Hostip Client
- IDNA
- Requests
- SQLParse
- URLLib3

---
