An open API service indexing awesome lists of open source software.

https://github.com/anqorithm/zloggerkit


https://github.com/anqorithm/zloggerkit

Last synced: 6 days ago
JSON representation

Awesome Lists containing this project

README

        

# ZLoggerKit

ZLoggerKit Logo

A structured logging utility for Python applications with support for multiple subsystems, JSON formatting, and Saudi Arabia timezone.

## Features

- Structured logging with JSON support
- Multiple subsystem support (AUTH, DATABASE, CACHE, NETWORK, etc.)
- Saudi Arabia timezone support
- Network request/response logging
- File-based logging with daily rotation
- Singleton pattern per subsystem
- Type validation using Pydantic models
- Debug, Info, Warning, and Error log levels

## Installation

### Using Poetry (Recommended)

1. Make sure you have Poetry installed:

```bash
curl -sSL https://install.python-poetry.org | python3 -
```

2. Add ZLoggerKit to your project:

```bash
# Add ZLoggerKit as a dependency
poetry add zloggerkit

# Or clone and install from source
git clone https://github.com/anqorithm/ZLoggerKit.git
cd ZLoggerKit
poetry install
```

3. Activate the virtual environment:

```bash
poetry shell
```

## Development Setup

1. Clone the repository:

```bash
git clone https://github.com/anqorithm/ZLoggerKit.git
cd ZLoggerKit
```

2. Install dependencies with Poetry:

```bash
poetry install
```

3. Run tests:

```bash
poetry run pytest
```

4. Format code:

```bash
poetry run black .
poetry run isort .
```

5. Check types:

```bash
poetry run mypy .
```

## Project Structure

```mermaid
graph TD;
A[ZLoggerKit] --> B[AUTH Subsystem]
A --> C[DATABASE Subsystem]
A --> D[CACHE Subsystem]
A --> E[NETWORK Subsystem]
B --> F[Logger]
C --> F[Logger]
D --> F[Logger]
E --> F[Logger]
F --> G[JSON Formatter]
F --> H[File Handler]
F --> I[Console Handler]
F --> J[Saudi Arabia Timezone]
```

## Logging Flow

```mermaid
sequenceDiagram
participant User
participant Logger
participant Formatter
participant Handler
participant Timezone

User->>Logger: Log Message
Logger->>Formatter: Format Message
Formatter->>Handler: Handle Message
Handler->>Timezone: Apply Timezone
Timezone->>Handler: Return Timestamp
Handler->>Logger: Log Completed
```