# jonecuper/customloggerphp architecture

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

- Interactive diagram: https://gitdiagram.com/jonecuper/customloggerphp
- Repository: https://github.com/jonecuper/customloggerphp

## Overview

##### Main Components

a) Logging System Components:
- CustomLog Handler (Primary Component)
- Log Storage System
- Log Rotation Manager
- Error Analysis System
- State Management System
- Email Notification System

##### Component Relationships

**[Application Layer]**
- ↓
**[CustomLog Handler]**
- ↓
**[Log Storage System] ←→ [Log Rotation Manager]**
- ↓
**[Error Analysis System] ←→ [State Management System]**
- ↓
**[Email Notification System] → [SMTP Server]**

##### Detailed Component Specifications

For each component, include these details:

CustomLog Handler:
- Input: message, level, logDir, logFileName, maxFileSize
- Supported levels: INFO, ERROR, DEBUG
- File size monitoring

Log Storage System:
- Location: /local/logs/
- File naming convention
- Size limitations (1MB default)

Error Analysis System:
- State file: error_state.json
- Timestamp tracking
- Error pattern matching

Notification System:
- Integration with 1C-Bitrix email events
- ERROR_NOTIFICATION event handling
- Admin email configuration

##### Integration Points

Highlight:
- 1C-Bitrix platform integration
- File system interaction
- SMTP service connection

- State management indicators

This will provide a comprehensive view of how the logging system captures, processes, and notifies about errors while maintaining state and handling log rotation.

## Diagram (Mermaid)

```mermaid
flowchart TB
    %% Main Components
    subgraph Application
        APP[Application Layer]
    end

    subgraph Core
        CH[CustomLog Handler]
        LM[Log Rotation Manager]
        LS[(Log Storage System)]
        EA[Error Analysis System]
        SM[(State Management System)]
        NS[Email Notification System]
        SMTP[SMTP Server]
    end

    %% Relationships
    APP --> CH
    CH --> LS
    LS <--> LM
    LS --> EA
    EA <--> SM
    EA --> NS
    NS --> SMTP

    %% Styling
    classDef default fill:#f9f9f9,stroke:#333,stroke-width:2px
    classDef storage fill:#90EE90,stroke:#333,stroke-width:2px
    classDef analysis fill:#ADD8E6,stroke:#333,stroke-width:2px
    classDef decision fill:#FFD700,stroke:#333,stroke-width:2px
    classDef notification fill:#FFB6C1,stroke:#333,stroke-width:2px

    class LS,SM storage
    class CH,EA analysis
    class LM decision
    class NS,SMTP notification

    %% Click Events
    click CH "https://github.com/Jonecuper/customLoggerPHP/blob/main/CustomLog.php"
    click EA "https://github.com/Jonecuper/customLoggerPHP/blob/main/AnalyzeLogForErrors.php"

    %% Legend
    subgraph Legend
        L1[Core Components]:::analysis
        L2[(Storage Systems)]:::storage
        L3[Decision Points]:::decision
        L4[Notification Components]:::notification
    end
```
