concept: DAW observability stack -- logging, debug, hailjan #97

Open
opened 2026-05-28 06:23:36 +02:00 by michael · 2 comments
Owner

Goal

Define the DAW observability stack as a coherent concept before
implementing individual components.

Components

  • daw.common.log -- centralized logging (levels, targets, config)
  • daw.common.debug -- developer tracing (--debug flag, per-module)
  • hailjan -- monitoring, metrics, alerting (separate project)

Open questions

  • How do logging and hailjan relate? Is hailjan a log sink?
  • Single module daw.common.log with debug as a level, or separate?
  • How does log state flow through programs -- injected, singleton, global?
  • What is the wire format between programs and hailjan?
  • File logging in daw.common.log vs. hailjan as the file/remote sink?
  • DAW_DEBUG env var vs. --debug flag vs. config file?

Next steps

  1. Define the concept and answer open questions
  2. Split into implementation issues per component
  3. Implement daw.common.log first (foundation for others)

See also

## Goal Define the DAW observability stack as a coherent concept before implementing individual components. ## Components - **daw.common.log** -- centralized logging (levels, targets, config) - **daw.common.debug** -- developer tracing (--debug flag, per-module) - **hailjan** -- monitoring, metrics, alerting (separate project) ## Open questions - How do logging and hailjan relate? Is hailjan a log sink? - Single module daw.common.log with debug as a level, or separate? - How does log state flow through programs -- injected, singleton, global? - What is the wire format between programs and hailjan? - File logging in daw.common.log vs. hailjan as the file/remote sink? - DAW_DEBUG env var vs. --debug flag vs. config file? ## Next steps 1. Define the concept and answer open questions 2. Split into implementation issues per component 3. Implement daw.common.log first (foundation for others) ## See also - DAW/fragjan#95 (centralized logging module) - DAW/fragjan#96 (centralized debug module) - hailjan project (TBD)
michael added this to the Basic Version milestone 2026-05-30 16:08:42 +02:00
Author
Owner

Concept clarification

Architecture decision

daw.common.log has a single responsibility: format and forward.
It calls only adapters/log -- the adapter decides where output goes.

daw.common.log -> adapters/log -> file
                               -> adapters/ui -> berhtjan-cli/web/api
                               -> both simultaneously
                               -> nothing (if not configured)

Answers to open questions

How do logging and hailjan relate? Is hailjan a log sink?
No. hailjan is a contract observer, not a log sink. It writes anomalies
to var/hailjan/anomalies.jsonl independently. No coupling to
daw.common.log or adapters/log.

Single module daw.common.log with debug as a level, or separate?
Single module. DEBUG is a level like INFO/WARN/ERROR (see daw-project-standard).
DAW/fragjan#96 (debug module) should be re-evaluated -- likely not needed
as a separate module.

How does log state flow through programs?
Via ctx. adapters/log is initialized at startup and passed through
ctx to all callers. No singleton, no global.

What is the wire format between programs and hailjan?
Not applicable -- hailjan is not a log consumer.
hailjan writes var/hailjan/anomalies.jsonl independently.

File logging in daw.common.log vs. hailjan as the file/remote sink?
File logging belongs to adapters/log. Pattern follows adapters/storage:
adapter defines the contract, backend implements it (file today, remote later).

DAW_DEBUG env var vs. --debug flag vs. config file?
--debug flag already exists in fragjan. Value flows via ctx.
No DAW_DEBUG env var -- env access is restricted to bin/wrapper via sys.lua
(see daw-project-standard, environment access rule).

Revised component overview

daw.common.log   -- format + forward to adapters/log
adapters/log     -- contract: where to write (file, ui, both)
adapters/ui      -- extended with log operation for UI output
hailjan          -- independent: contract observation, anomaly tracking

Dependencies

  • DAW/fragjan#90 -- adapters/ui must be extended with output operations first
  • DAW/fragjan#95 -- implements daw.common.log (after adapters/log contract defined)
  • DAW/fragjan#96 -- re-evaluate: DEBUG level in daw.common.log may be sufficient

Next step

Define adapters/log contract (required_ops, _contracts) as foundation
for DAW/fragjan#95.

## Concept clarification ### Architecture decision `daw.common.log` has a single responsibility: format and forward. It calls only `adapters/log` -- the adapter decides where output goes. ``` daw.common.log -> adapters/log -> file -> adapters/ui -> berhtjan-cli/web/api -> both simultaneously -> nothing (if not configured) ``` ### Answers to open questions **How do logging and hailjan relate? Is hailjan a log sink?** No. hailjan is a contract observer, not a log sink. It writes anomalies to `var/hailjan/anomalies.jsonl` independently. No coupling to `daw.common.log` or `adapters/log`. **Single module daw.common.log with debug as a level, or separate?** Single module. DEBUG is a level like INFO/WARN/ERROR (see daw-project-standard). DAW/fragjan#96 (debug module) should be re-evaluated -- likely not needed as a separate module. **How does log state flow through programs?** Via `ctx`. `adapters/log` is initialized at startup and passed through `ctx` to all callers. No singleton, no global. **What is the wire format between programs and hailjan?** Not applicable -- hailjan is not a log consumer. hailjan writes `var/hailjan/anomalies.jsonl` independently. **File logging in daw.common.log vs. hailjan as the file/remote sink?** File logging belongs to `adapters/log`. Pattern follows `adapters/storage`: adapter defines the contract, backend implements it (file today, remote later). **DAW_DEBUG env var vs. --debug flag vs. config file?** `--debug` flag already exists in fragjan. Value flows via `ctx`. No DAW_DEBUG env var -- env access is restricted to `bin/wrapper` via sys.lua (see daw-project-standard, environment access rule). ### Revised component overview ``` daw.common.log -- format + forward to adapters/log adapters/log -- contract: where to write (file, ui, both) adapters/ui -- extended with log operation for UI output hailjan -- independent: contract observation, anomaly tracking ``` ### Dependencies - DAW/fragjan#90 -- adapters/ui must be extended with output operations first - DAW/fragjan#95 -- implements daw.common.log (after adapters/log contract defined) - DAW/fragjan#96 -- re-evaluate: DEBUG level in daw.common.log may be sufficient ### Next step Define `adapters/log` contract (required_ops, _contracts) as foundation for DAW/fragjan#95.
Author
Owner

adapters/log contract definition

Architecture decision

adapters/log is a standard interface adapter following the adapters/storage pattern.
Concrete log backends attach as DAW modules. The UI target is a special case --
adapters/log calls adapters/ui directly, no module in between.

Routing model

daw.common.log -> daw_log/v1 -> adapters/log -> daw.log.file   (module)
                                             -> daw.log.syslog (module)
                                             -> adapters/ui    (direct call)

Each target is optional. If the config section is absent, the target is inactive.

Required operations

M._contracts = {
  check        = "bool_or_err",
  required_ops = "list",
  write        = "bool_or_err",
  open         = "bool_or_err",
  close        = "bool_or_err",
}
  • open(cfg) -- initialize all configured targets, return true|nil, err
  • write(entry) -- route daw_log/v1 entry to all matching targets
  • close() -- release all target resources

Level filtering

Each target defines its minimum level independently via config.
adapters/log filters per target before dispatching.

Config structure (fragjan.conf)

[logging.file]
level = info
path  = var/log/fragjan.log

[logging.debug]
level = debug
path  = var/log/fragjan.debug.log

[logging.syslog]
level = warn

[logging.ui]
level = error

[logging.debug] is a second instance of daw.log.file -- not a special case.
[logging.ui] routes to adapters/ui directly, no module.

Module interface (daw.log.*)

Modules implement:

open(config)     -> true|nil, err
write(entry)     -> true|nil, err   -- entry is daw_log/v1 table
close()          -> nil

First module: DAW/daw-modul-log-file (DAW/fragjan#117)

Startup behavior

adapters/log is initialized in main.lua as one of the first steps,
before ctx is fully built.

On open() failure (missing module, bad config):

  • main.lua writes a pre-error directly to stderr
  • follows the same pattern as other early startup failures
  • fragjan exits, no silent fallback

If no [logging.*] section is configured: adapters/log is inactive,
no error, no output. Intentional zero-logging is valid.

Next steps

## adapters/log contract definition ### Architecture decision adapters/log is a standard interface adapter following the adapters/storage pattern. Concrete log backends attach as DAW modules. The UI target is a special case -- adapters/log calls adapters/ui directly, no module in between. ### Routing model ``` daw.common.log -> daw_log/v1 -> adapters/log -> daw.log.file (module) -> daw.log.syslog (module) -> adapters/ui (direct call) ``` Each target is optional. If the config section is absent, the target is inactive. ### Required operations ```lua M._contracts = { check = "bool_or_err", required_ops = "list", write = "bool_or_err", open = "bool_or_err", close = "bool_or_err", } ``` - open(cfg) -- initialize all configured targets, return true|nil, err - write(entry) -- route daw_log/v1 entry to all matching targets - close() -- release all target resources ### Level filtering Each target defines its minimum level independently via config. adapters/log filters per target before dispatching. ### Config structure (fragjan.conf) ```ini [logging.file] level = info path = var/log/fragjan.log [logging.debug] level = debug path = var/log/fragjan.debug.log [logging.syslog] level = warn [logging.ui] level = error ``` `[logging.debug]` is a second instance of daw.log.file -- not a special case. `[logging.ui]` routes to adapters/ui directly, no module. ### Module interface (daw.log.*) Modules implement: ``` open(config) -> true|nil, err write(entry) -> true|nil, err -- entry is daw_log/v1 table close() -> nil ``` First module: DAW/daw-modul-log-file (DAW/fragjan#117) ### Startup behavior adapters/log is initialized in main.lua as one of the first steps, before ctx is fully built. On open() failure (missing module, bad config): - main.lua writes a pre-error directly to stderr - follows the same pattern as other early startup failures - fragjan exits, no silent fallback If no [logging.*] section is configured: adapters/log is inactive, no error, no output. Intentional zero-logging is valid. ### Next steps - DAW/fragjan#95 -- implement daw.common.log (producer) - DAW/fragjan#117 (new) -- implement daw.log.file module - DAW/fragjan#96 -- close: DEBUG is a level in daw.common.log, no separate module needed
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
DAW/fragjan#97
No description provided.