Skip to main content

Module logging

Module logging 

Source
Expand description

File-based log writing for hermod-tracer

Each node gets its own subdirectory under the configured logRoot. Within that directory, log output is written to a timestamped file:

{logRoot}/
└── {node-id}/
    ├── node-2024-01-15T10-30-00.json   ← previous file
    ├── node-2024-01-15T12-00-00.json   ← current file
    └── node.json                        ← symlink → current file

The symlink is updated atomically via a .tmp rename so readers always see a consistent target.

Two formats are supported:

Structs§

LogHandle
One open log file
LogKey
A key into the handle cache
LogWriter
Shared writer — holds open file handles for all active (node, logging-config) pairs

Functions§

format_human
Human-readable format: {timestamp} [{severity}] {namespace} {message}\n
format_machine
Machine-readable format: JSON line
format_trace
Format a single trace as a line (with trailing newline)