# phantom-vk/logguard architecture

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

- Interactive diagram: https://gitdiagram.com/phantom-vk/logguard
- Repository: https://github.com/phantom-vk/logguard

## Overview

##### Main Components

a) Core Application Layer:
- Entry point (main.py)
- Configuration (enableEV.py)
- Attribute management (all_atributes.py)

b) Backend Processing Layer:
- Event Processing Module (event_processor.py)
- Analysis Engine (analyzer.py)
- Event Logging System (event_logger.py)
- Time Management (timeUtils.py)
- Export Functionality (export_utils.py)

c) Database Layer:
- Database Utilities (db_utils.py)

d) Output/Storage:
- Log Files (app.log, event_logs.log)
- Export Files (exported_logs.csv)

##### Component Relationships

**[Main Application Layer]**
- ↓
**[Backend Processing Layer]**
- ↓
**[Database Layer]**
- ↓
**[Storage/Output Layer]**

##### Flow Representation

- Data flow from main.py to the backend processors
- Event processing flow through the analyzer and logger
- Database interactions
- Export operations

##### Detailed Component Connections

**[main.py] → [enableEV.py]**
- ↓
**[event_processor.py] ← [timeUtils.py]**
- ↓
**[analyzer.py] → [event_logger.py]**
- ↓
**[export_utils.py] → [exported_logs.csv]**
- ↓
**[db_utils.py] → [Database Storage]**

##### Additional Elements

Supporting elements:
- External interfaces
- File I/O points
- Processing pipelines

##### Notes for Implementation

- Keep the core processing flow central
- Related components (e.g., all logging-related modules)
- Clear separation between processing and storage layers
- Async operations if present
- Critical paths

Remember to:
- Version information
- Timestamps for logs and exports
- Error handling paths
- Configuration dependencies
- Primary and secondary data flows

This will create a comprehensive yet clear representation of the system's architecture that effectively communicates its design to other team members.

## Diagram (Mermaid)

```mermaid
flowchart TB
    %% Styles
    classDef core fill:#b3d1ff,stroke:#333,stroke-width:2px
    classDef processing fill:#98FB98,stroke:#333,stroke-width:2px
    classDef database fill:#FFE4B5,stroke:#333,stroke-width:2px
    classDef storage fill:#D3D3D3,stroke:#333,stroke-width:2px
    
    %% Core Application Layer
    subgraph CoreLayer["Core Application Layer"]
        Main["Main Entry Point"]:::core
        Config["Configuration"]:::core
        Attributes["Attribute Management"]:::core
    end
    
    %% Backend Processing Layer
    subgraph ProcessingLayer["Backend Processing Layer"]
        EventProcessor["Event Processor"]:::processing
        Analyzer["Analysis Engine"]:::processing
        EventLogger["Event Logger"]:::processing
        TimeUtils["Time Management"]:::processing
        ExportUtils["Export Utilities"]:::processing
    end
    
    %% Database Layer
    subgraph DBLayer["Database Layer"]
        DBUtils["Database Utilities"]:::database
        DB[(Database Storage)]:::database
    end
    
    %% Storage Layer
    subgraph StorageLayer["Storage Layer"]
        AppLog[("app.log")]:::storage
        EventLog[("event_logs.log")]:::storage
        ExportedData[("exported_logs.csv")]:::storage
    end
    
    %% Relationships
    Main --> Config
    Main --> Attributes
    Config --> EventProcessor
    EventProcessor --> Analyzer
    TimeUtils --> EventProcessor
    Analyzer --> EventLogger
    EventLogger --> AppLog
    EventLogger --> EventLog
    ExportUtils --> ExportedData
    EventProcessor --> DBUtils
    DBUtils --> DB
    
    %% Click Events
    click Main "https://github.com/Phantom-VK/LogGuard/blob/main/main.py"
    click Config "https://github.com/Phantom-VK/LogGuard/blob/main/enableEV.py"
    click Attributes "https://github.com/Phantom-VK/LogGuard/blob/main/all_atributes.py"
    click EventProcessor "https://github.com/Phantom-VK/LogGuard/blob/main/backend/event_processor.py"
    click Analyzer "https://github.com/Phantom-VK/LogGuard/blob/main/backend/analyzer.py"
    click EventLogger "https://github.com/Phantom-VK/LogGuard/blob/main/backend/event_logger.py"
    click TimeUtils "https://github.com/Phantom-VK/LogGuard/blob/main/backend/timeUtils.py"
    click ExportUtils "https://github.com/Phantom-VK/LogGuard/blob/main/backend/export_utils.py"
    click DBUtils "https://github.com/Phantom-VK/LogGuard/blob/main/database/db_utils.py"
    click AppLog "https://github.com/Phantom-VK/LogGuard/blob/main/app.log"
    click EventLog "https://github.com/Phantom-VK/LogGuard/blob/main/event_logs.log"
    click ExportedData "https://github.com/Phantom-VK/LogGuard/blob/main/exported_logs.csv"
    
    %% Legend
    subgraph Legend
        CoreComp["Core Component"]:::core
        ProcessingComp["Processing Component"]:::processing
        DatabaseComp["Database Component"]:::database
        StorageComp["Storage Component"]:::storage
    end
```
