# sayujya-apte/asynclog architecture

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

- Interactive diagram: https://gitdiagram.com/sayujya-apte/asynclog
- Repository: https://github.com/sayujya-apte/asynclog

## Overview

AsyncLog is a C++ asynchronous logging library. An application configures a Logger, submits level-filtered messages (optionally formatted), and a worker consumes queued messages and writes to enabled console and file sinks. The source shows queue synchronization, timestamp/level formatting, and ANSI removal for file output; custom logger inheritance is documented. The repository is small, so the graph focuses on runtime behavior rather than build machinery.

Main entry points: [`AsyncLog/Logger.h`](https://github.com/sayujya-apte/asynclog/blob/main/AsyncLog/Logger.h) (Logger), [`AsyncLog/Logger.cpp`](https://github.com/sayujya-apte/asynclog/blob/main/AsyncLog/Logger.cpp) (Logging worker), [`AsyncLog/Core.h`](https://github.com/sayujya-apte/asynclog/blob/main/AsyncLog/Core.h) (Levels and colors), [`AsyncLog/LogQueue.cpp`](https://github.com/sayujya-apte/asynclog/blob/main/AsyncLog/LogQueue.cpp) (Thread-safe queue)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_api["Logging API"]
  node_logger["Logger<br/>[Logger.h]"]
  node_format["Message formatting<br/>[Logger.cpp]"]
  node_levels["Levels and colors<br/>[Core.h]"]
end

subgraph group_worker["Async processing"]
  node_queue["Thread-safe queue<br/>[LogQueue.cpp]"]
  node_worker["Logging worker<br/>[Logger.cpp]"]
end

subgraph group_sinks["Output sinks"]
  node_file[("File output<br/>[Logger.cpp]")]
  node_console["Console output<br/>[Logger.cpp]"]
end

node_app(("Application"))
node_clock["System clock"]

node_app -->|"configures and calls"| node_logger
node_logger -->|"filters by"| node_levels
node_logger -->|"formats message"| node_format
node_format -->|"gets timestamp"| node_clock
node_format -->|"uses labels and colors"| node_levels
node_logger -->|"enqueues"| node_queue
node_worker -->|"dequeues"| node_queue
node_worker -->|"writes stripped text"| node_file
node_worker -->|"writes colored text"| node_console

click node_logger "https://github.com/sayujya-apte/asynclog/blob/main/AsyncLog/Logger.h"
click node_format "https://github.com/sayujya-apte/asynclog/blob/main/AsyncLog/Logger.cpp"
click node_levels "https://github.com/sayujya-apte/asynclog/blob/main/AsyncLog/Core.h"
click node_queue "https://github.com/sayujya-apte/asynclog/blob/main/AsyncLog/LogQueue.cpp"
click node_worker "https://github.com/sayujya-apte/asynclog/blob/main/AsyncLog/Logger.cpp"
click node_file "https://github.com/sayujya-apte/asynclog/blob/main/AsyncLog/Logger.cpp"
click node_console "https://github.com/sayujya-apte/asynclog/blob/main/AsyncLog/Logger.cpp"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_logger,node_format,node_levels toneBlue
class node_queue,node_worker toneAmber
class node_file,node_console toneMint
class node_app,node_clock toneIndigo
```

## Components

### Logging API

- [Logger](https://github.com/sayujya-apte/asynclog/blob/main/AsyncLog/Logger.h): `AsyncLog/Logger.h`
- [Message formatting](https://github.com/sayujya-apte/asynclog/blob/main/AsyncLog/Logger.cpp): `AsyncLog/Logger.cpp`
- [Levels and colors](https://github.com/sayujya-apte/asynclog/blob/main/AsyncLog/Core.h): `AsyncLog/Core.h`

### Async processing

- [Thread-safe queue](https://github.com/sayujya-apte/asynclog/blob/main/AsyncLog/LogQueue.cpp): `AsyncLog/LogQueue.cpp`
- [Logging worker](https://github.com/sayujya-apte/asynclog/blob/main/AsyncLog/Logger.cpp): `AsyncLog/Logger.cpp`

### Output sinks

- [File output](https://github.com/sayujya-apte/asynclog/blob/main/AsyncLog/Logger.cpp): `AsyncLog/Logger.cpp`
- [Console output](https://github.com/sayujya-apte/asynclog/blob/main/AsyncLog/Logger.cpp): `AsyncLog/Logger.cpp`

### Other components

- **Application**
- **System clock**

## Connections

- Application → Logger: configures and calls
- Logger → Levels and colors: filters by
- Logger → Message formatting: formats message
- Message formatting → System clock: gets timestamp
- Message formatting → Levels and colors: uses labels and colors
- Logger → Thread-safe queue: enqueues
- Logging worker → Thread-safe queue: dequeues
- Logging worker → File output: writes stripped text
- Logging worker → Console output: writes colored text
