mirror of
https://github.com/azaion/loader.git
synced 2026-04-22 22:16:32 +00:00
4eaf218f09
Made-with: Cursor
68 lines
1.9 KiB
Markdown
68 lines
1.9 KiB
Markdown
# Module: constants
|
||
|
||
## Purpose
|
||
|
||
Centralizes shared configuration constants and provides the application-wide logging interface via Loguru.
|
||
|
||
## Public Interface
|
||
|
||
### Constants (cdef, module-level)
|
||
|
||
| Name | Type | Value |
|
||
|---------------|------|--------------|
|
||
| CDN_CONFIG | str | `"cdn.yaml"` |
|
||
| SMALL_SIZE_KB | int | `3` |
|
||
|
||
Note: `QUEUE_MAXSIZE`, `COMMANDS_QUEUE`, `ANNOTATIONS_QUEUE` are declared in the `.pxd` but not defined in the `.pyx` — they are unused in this codebase.
|
||
|
||
### Functions (cdef, Cython-only visibility)
|
||
|
||
| Function | Signature | Description |
|
||
|------------------------|----------------------------|------------------------------|
|
||
| `log` | `cdef log(str log_message)` | Logs at INFO level via Loguru |
|
||
| `logerror` | `cdef logerror(str error)` | Logs at ERROR level via Loguru |
|
||
|
||
## Internal Logic
|
||
|
||
Loguru is configured with three sinks:
|
||
- **File sink**: under `LOG_DIR`, path template `log_loader_{time:YYYYMMDD}.txt`, INFO level, daily rotation, 30-day retention, async (enqueue=True)
|
||
- **Stdout sink**: DEBUG level, filtered to INFO/DEBUG/SUCCESS only, colorized
|
||
- **Stderr sink**: WARNING+ level, colorized
|
||
|
||
Log format: `[HH:mm:ss LEVEL] message`
|
||
|
||
## Dependencies
|
||
|
||
- **Internal**: none (leaf module)
|
||
- **External**: `loguru` (0.7.3), `os`, `sys`
|
||
|
||
## Consumers
|
||
|
||
- `hardware_service` — calls `log()`
|
||
- `cdn_manager` — calls `log()`, `logerror()`
|
||
- `api_client` — calls `log()`, `logerror()`, reads `CDN_CONFIG`, `SMALL_SIZE_KB`
|
||
|
||
## Data Models
|
||
|
||
None.
|
||
|
||
## Configuration
|
||
|
||
| Env Variable | Default | Description |
|
||
|--------------|---------|--------------------------------------|
|
||
| LOG_DIR | `Logs` | Directory for daily log files |
|
||
|
||
The file sink uses Loguru’s `{time:YYYYMMDD}` in the filename under `LOG_DIR`.
|
||
|
||
## External Integrations
|
||
|
||
None.
|
||
|
||
## Security
|
||
|
||
None.
|
||
|
||
## Tests
|
||
|
||
No tests found.
|