# buraktabn/one_logger architecture

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

- Interactive diagram: https://gitdiagram.com/buraktabn/one_logger
- Repository: https://github.com/buraktabn/one_logger

## Overview

- Logger Core: Represent the main Logger class (located in lib/one_logger.dart) that provides the primary logging methods (trace, info, warn, etc.).
- Logger Options & Filters: Highlight components such as LoggerOptions, LoggerFilter (along with its DevelopmentLoggerFilter and ProductionLoggerFilter), and customization points for styling and behavior (found under lib/src/options/ and referenced in the README).
- Loki Integration: Show the dedicated Loki support module (within lib/src/loki/) including LokiOptions and Pusher, which handle configuration and log dispatch to the remote Loki server.

##### Component Relationships and Flow
- That the Logger internally leverages helper modules (lib/src/helper.dart) and may call into ANSI support functions (from lib/src/support/) when printing logs.

##### Architectural Patterns and Design Principles
- Modularity: The package is organized into clear submodules (options, logger core, ANSI support, Loki integration), which makes it easy to extend or modify specific behaviors.
- Separation of Concerns: Configuration, logging output, and external log dispatch (to Loki) are distinctly separated into different components.
- Extensibility: The use of abstract LoggerFilter and customizable LoggerOptions allows for extension in various operational contexts (development vs. production).

## Diagram (Mermaid)

```mermaid
graph TD
    ExampleUsage["Example / Usage"]:::example
    Logger["Logger Core"]:::core
    LogOptions["Logger Options"]:::config
    LogFilter["Logger Filter (Dev/Prod)"]:::config
    LogStyle["Logger Style/Customization"]:::config
    LogHelper["Logger Helper Module"]:::helper

    subgraph "ANSI Support Modules"
        ANSI1["support_ansi"]:::support
        ANSI2["support_ansi_io"]:::support
        ANSI3["support_ansi_web"]:::support
    end

    subgraph "Loki Integration"
        LokiOpt["Loki Options"]:::integration
        LokiPush["Loki Pusher"]:::integration
    end

    ExampleUsage -->|"uses"| Logger
    Logger -->|"configures"| LogOptions
    Logger -->|"applies"| LogFilter
    Logger -->|"customizes"| LogStyle
    Logger -->|"utilizes"| LogHelper
    Logger -->|"formatsWith"| ANSI1
    Logger -->|"formatsWith"| ANSI2
    Logger -->|"formatsWith"| ANSI3
    Logger -->|"sendsLogs"| LokiOpt
    Logger -->|"sendsLogs"| LokiPush

    click Logger "https://github.com/buraktabn/one_logger/blob/main/lib/one_logger.dart"
    click LogOptions "https://github.com/buraktabn/one_logger/blob/main/lib/src/options/options.dart"
    click LogFilter "https://github.com/buraktabn/one_logger/blob/main/lib/src/options/filter.dart"
    click LogStyle "https://github.com/buraktabn/one_logger/blob/main/lib/src/options/style.dart"
    click LogHelper "https://github.com/buraktabn/one_logger/blob/main/lib/src/helper.dart"
    click ANSI1 "https://github.com/buraktabn/one_logger/blob/main/lib/src/support/support_ansi.dart"
    click ANSI2 "https://github.com/buraktabn/one_logger/blob/main/lib/src/support/support_ansi_io.dart"
    click ANSI3 "https://github.com/buraktabn/one_logger/blob/main/lib/src/support/support_ansi_web.dart"
    click LokiOpt "https://github.com/buraktabn/one_logger/blob/main/lib/src/loki/options.dart"
    click LokiPush "https://github.com/buraktabn/one_logger/blob/main/lib/src/loki/pusher.dart"

    classDef core fill:#ADD8E6,stroke:#000,stroke-width:2px;
    classDef config fill:#90EE90,stroke:#000,stroke-width:2px;
    classDef helper fill:#FFD700,stroke:#000,stroke-width:2px;
    classDef support fill:#FFB6C1,stroke:#000,stroke-width:2px;
    classDef integration fill:#F0E68C,stroke:#000,stroke-width:2px;
    classDef example fill:#D3D3D3,stroke:#000,stroke-width:2px;
```
