# georgeyk/belogging architecture

> Architecture diagram of the GitHub repository georgeyk/belogging, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2024-12-28). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/georgeyk/belogging
- Repository: https://github.com/georgeyk/belogging

## Overview

##### Project Type Analysis
This is an open-source utility library focused on simplifying logging configuration through environment variables. The project is relatively small but serves a specific purpose in the Python ecosystem.

##### Main Components

a. Core Components:
- Environment Variables Handler
- Logging Configuration Manager
- Formatter System (Standard & JSON)
- Logger Registry
- Filter System

b. External Interfaces:
- Python's Standard Logging Module
- Environment Variables Interface
- stdout Stream

**┌─ Application Layer ─────────────────────┐**
- Client Application                      │
- (Django, Python Scripts, etc.)          │
- ┬────────────────────┬─┘

**┌──────────────────▼────────────────────▼─┐**
- Belogging Interface Layer               │
- ┌─────────────┐  ┌────────────────┐    │
- belogging.   │  │belogging.      │    │
- load()       │  │getLogger()     │    │
- ┴──────┬──────┴──┴────────────────┴────┘

**┌────────▼────────────────────────────────┐**
- Configuration Layer                      │
- ┌─────────────┐  ┌────────────────┐    │
- Environment  │  │Default         │    │
- Variables    │  │Configuration   │    │
- ┬───────┘  └────────┬───────┘    │
- ┼────────────────────┼───────────┘

**┌───────▼────────────────────▼───────────┐**
- Core Processing Layer                   │
- ┌─────────────┐  ┌────────────────┐    │
- Logging      │  │Filter          │    │
- Manager      │  │System          │    │
- ┬───────┘  └────────┬───────┘    │

- ┌─────▼───────┐  ┌───────▼────────┐   │
- Standard     │  │JSON            │   │
- Formatter    │  │Formatter       │   │
- ┴─────────────┴──┴───────────────┴────┘

**┌────────▼────────────────────────────────┐**
- Output Layer                            │
- ┌─────────────┐                         │
- stdout       │                         │
- ┘                         │
- ┘

##### Key Elements to Highlight

a. Environment Variables:
- LOG_LEVEL
- LOGGERS
- How they influence the configuration

b. Integration Points:
- Python's logging module
- Application integration points
- stdout handling

c. Processing Flow:
- Configuration loading
- Logger creation
- Message filtering
- Formatting (Standard/JSON)
- Output handling

##### Important Notes

- Keep the focus on the configuration flow and how environment variables affect the logging behavior
- Relationship between belogging and Python's standard logging module
- Flexibility of logger selection through the LOGGERS environment variable
- Demonstrate the formatter options (standard and JSON)
- Filtering mechanism that handles logger enabling/disabling

## Diagram (Mermaid)

```mermaid
graph TB
    %% Style Definitions
    classDef interface fill:#a8d1f0,stroke:#333
    classDef core fill:#90EE90,stroke:#333
    classDef config fill:#FFE5B4,stroke:#333
    classDef output fill:#E5E4E2,stroke:#333
    classDef app fill:#FFB6C1,stroke:#333

    %% Application Layer
    subgraph AppLayer["Application Layer"]
        Client["Client Application"]:::app
    end

    %% Interface Layer
    subgraph InterfaceLayer["Belogging Interface Layer"]
        LoadAPI["belogging.load()"]:::interface
        GetLoggerAPI["belogging.getLogger()"]:::interface
    end

    %% Configuration Layer
    subgraph ConfigLayer["Configuration Layer"]
        EnvVars["Environment Variables"]:::config
        DefaultConfig["Default Configuration"]:::config
    end

    %% Core Processing Layer
    subgraph CoreLayer["Core Processing Layer"]
        LogManager["Logging Manager"]:::core
        FilterSystem["Filter System"]:::core
        StdFormatter["Standard Formatter"]:::core
        JsonFormatter["JSON Formatter"]:::core
    end

    %% Output Layer
    subgraph OutputLayer["Output Layer"]
        Stdout["stdout"]:::output
    end

    %% Relationships
    Client --> LoadAPI
    Client --> GetLoggerAPI
    LoadAPI --> EnvVars
    LoadAPI --> DefaultConfig
    EnvVars --> LogManager
    DefaultConfig --> LogManager
    LogManager --> FilterSystem
    LogManager --> StdFormatter
    LogManager --> JsonFormatter
    StdFormatter --> Stdout
    JsonFormatter --> Stdout

    %% Click Events
    click LogManager "https://github.com/georgeyk/belogging/blob/master/src/belogging/loader.py"
    click FilterSystem "https://github.com/georgeyk/belogging/blob/master/src/belogging/filters.py"
    click DefaultConfig "https://github.com/georgeyk/belogging/blob/master/src/belogging/defaults.py"
    click InterfaceLayer "https://github.com/georgeyk/belogging/blob/master/src/belogging/__init__.py"
    click JsonFormatter "https://github.com/georgeyk/belogging/blob/master/tests/json_example.py"
    click StdFormatter "https://github.com/georgeyk/belogging/blob/master/tests/example.py"
    click CoreLayer "https://github.com/georgeyk/belogging/tree/master/src/belogging/"

    %% Legend
    subgraph Legend["Legend"]
        L1["Application Component"]:::app
        L2["Interface Component"]:::interface
        L3["Core Component"]:::core
        L4["Configuration Component"]:::config
        L5["Output Component"]:::output
    end
```
