# wmtrnsapanzaveri/snug_logger architecture

> Architecture diagram of the GitHub repository wmtrnsapanzaveri/snug_logger, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-01-18). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/wmtrnsapanzaveri/snug_logger
- Repository: https://github.com/wmtrnsapanzaveri/snug_logger

## Overview

##### Main Components

a) Core Logging System:
- Base Logger Component
- Log Type Handler
- Log Formatting Utility
- Debug Print System

b) Network Logging System:
- Dio Logger Integration
- Request/Response Handlers
- Network Headers Manager

c) Utility Components:
- Common Utils
- Log Type Enums
- Network Titles

##### Component Relationships

**[Application Layer]**
- ↓
**[Logging Interface Layer]**
- ↓
**[Core Implementation Layer]**
- ↓
**[Utility Layer]**

##### Specific Implementation Details

**┌─ Application Integration Point ─┐**
- snugLog() Function           │
- SnugDioLogger Class          │
- ┘
- ↓
**┌─ Logging Core ─────────────────┐**
- Base Logger                  │
- Log Handlers                 │
- Log Type Management         │
- ┘
- ↓
**┌─ Network Logging ─────────────┐**
- Request Handler             │
- Response Handler            │
- Headers Management          │
- ┘
- ↓
**┌─ Utilities ──────────────────┐**
- Common Utils               │
- Debug Print               │
- Network Titles            │
- ┘

##### Important Elements to Highlight

a) Data Flow:
- Log creation → formatting → output
- Network request → interception → logging → response

b) Integration Points:
- Dio interceptor integration
- Direct logging function calls
- Custom print handler integration

##### Implementation Notes

- The modular nature of the logging system
- The separation between network and general logging
- The extensibility points for custom logging handlers
- The configuration options for different logging levels

## Diagram (Mermaid)

```mermaid
flowchart TB
    subgraph "Application Layer"
        A1["Application Integration Point"]
        A2["snugLog() Function"]
        A3["SnugDioLogger Class"]:::network
    end

    subgraph "Logging Interface Layer"
        B1["Base Logger"]:::core
        B2["Log Handler"]:::core
        B3["Log Model"]:::core
    end

    subgraph "Network Layer"
        C1["Dio Logger"]:::network
        C2["Request Handler"]:::network
        C3["Response Handler"]:::network
        C4["Headers Manager"]:::network
    end

    subgraph "Utility Layer"
        D1["Common Utils"]:::utility
        D2["Debug Print"]:::utility
        D3["Log Type Enums"]:::utility
        D4["Network Titles"]:::utility
    end

    %% Relationships
    A1 --> A2
    A1 --> A3
    A2 --> B1
    A3 --> B1
    B1 --> B2
    B2 --> B3
    B1 --> C1
    C1 --> C2
    C1 --> C3
    C1 --> C4
    B2 --> D2
    B1 --> D3
    C1 --> D4
    C2 --> D1
    C3 --> D1

    %% Click Events
    click B1 "https://github.com/wmtrnsapanzaveri/snug_logger/blob/main/lib/src/base_logger/snug_logger_base.dart"
    click B2 "https://github.com/wmtrnsapanzaveri/snug_logger/blob/main/lib/src/base_logger/log_handler.dart"
    click B3 "https://github.com/wmtrnsapanzaveri/snug_logger/blob/main/lib/src/model/log_detail.dart"
    click D2 "https://github.com/wmtrnsapanzaveri/snug_logger/blob/main/lib/src/utlis/debug_print.dart"
    click C1 "https://github.com/wmtrnsapanzaveri/snug_logger/blob/main/lib/src/dio_logger/snug_dio_logger.dart"
    click C3 "https://github.com/wmtrnsapanzaveri/snug_logger/blob/main/lib/src/dio_logger/dio_handlers/snug_dio_response_handler.dart"
    click D1 "https://github.com/wmtrnsapanzaveri/snug_logger/blob/main/lib/src/utlis/common_utlis.dart"
    click D3 "https://github.com/wmtrnsapanzaveri/snug_logger/blob/main/lib/src/utlis/log_type.dart"
    click D4 "https://github.com/wmtrnsapanzaveri/snug_logger/blob/main/lib/src/utlis/network_titles.dart"
    click A1 "https://github.com/wmtrnsapanzaveri/snug_logger/blob/main/lib/snug_logger.dart"

    %% Styles
    classDef core fill:#00bfff,stroke:#333,stroke-width:2px
    classDef network fill:#90EE90,stroke:#333,stroke-width:2px
    classDef utility fill:#D3D3D3,stroke:#333,stroke-width:2px

    %% Legend
    subgraph Legend
        L1["Core Components"]:::core
        L2["Network Components"]:::network
        L3["Utility Components"]:::utility
    end
```
