log: send records natively to journald, keep stdout off-unit
A record written to stdout carries no priority, so journald files the whole stream at one level and the swarm log store shows `info` whatever level `tracing` gave it. Under a systemd unit the process's stdout already *is* the journal, so the fix is to speak the journal protocol directly and let each record carry its own severity. New `hive-log` crate holds the one sink chooser, called by `hive-c0re`, `hive-agent` and `swarm-controller`. It builds the same `EnvFilter` those binaries always built, then installs exactly one layer — never both, since a journald layer stacked on the `fmt` layer under a unit stores every record twice. The choice is an fstat compare, not a presence test: a child inherits `$JOURNAL_STREAM` even when its own stdout was redirected elsewhere, so the variable existing proves nothing. The crate parses `dev:inode` out of it and compares both numbers against an fstat of stdout, the descriptor the `fmt` layer writes to by default. No match, unset, or unparseable takes the `fmt` branch. A journald layer that fails to construct despite a match falls back to `fmt` and warns through it — a process must never fail to start because of its logger.
This commit is contained in:
parent
893747a0e4
commit
8cc7f90c98
12 changed files with 316 additions and 36 deletions
|
|
@ -72,6 +72,14 @@ hand-maintained per-file tree drifts out of sync with the code.
|
|||
remix. `GraphWire::wire_snapshot` is blanket-implemented for any
|
||||
`Graph<N, R>` whose parameters implement both — so a payload that has
|
||||
never said how it displays cannot reach a viewer at all.
|
||||
- **`hive-log/`** — the one log-sink chooser, called by `hive-c0re`,
|
||||
`hive-agent` and `swarm-controller` and by nothing else. `init()` builds
|
||||
the `EnvFilter` those binaries always built, then installs **exactly
|
||||
one** sink: the native journald layer when an `fstat` of stdout matches
|
||||
the device and inode numbers systemd exports in `$JOURNAL_STREAM`, the
|
||||
`fmt` stdout layer otherwise. Under a unit stdout already **is** the
|
||||
journal, so both layers together store every record twice. Deliberately
|
||||
single-purpose — do not grow it into a utility crate.
|
||||
- **`hive-screen-mcp/`** — stdio MCP bridge for GUI agents
|
||||
(`hyperhive.gui.enable`): `screenshot` via `grim`, `type_text` /
|
||||
`key_press` via `wtype` (Wayland virtual-keyboard protocol), and
|
||||
|
|
|
|||
Loading…
Reference in a new issue