Skip to main content

Module logging

Module logging 

Source

Re-exportsยง

use crate::cli::Cli; ๐Ÿ”’
use crate::cli::DiagnosticsPreset; ๐Ÿ”’
use anyhow::Context as _; ๐Ÿ”’
use std::fs::File; ๐Ÿ”’
use std::fs::OpenOptions; ๐Ÿ”’
use std::fs::create_dir_all; ๐Ÿ”’
use std::fs::metadata; ๐Ÿ”’
use std::fs::remove_file; ๐Ÿ”’
use std::fs::rename; ๐Ÿ”’
use std::io::BufWriter; ๐Ÿ”’
use std::io::Write; ๐Ÿ”’
use std::path::Path; ๐Ÿ”’
use std::path::PathBuf; ๐Ÿ”’
use std::str::FromStr as _; ๐Ÿ”’
use tracing::level_filters::LevelFilter; ๐Ÿ”’
use tracing_appender::non_blocking::WorkerGuard; ๐Ÿ”’

Modulesยง

targets

Structsยง

LoggingRuntime
ResolvedLogPath ๐Ÿ”’
RollingFileWriter
Rotation is decided from the current write callโ€™s length, so a caller must hand over one whole record per call and keep it under the buffer capacity - a partial write re-enters the check with only the remainder.

Enumsยง

LogPathSource ๐Ÿ”’

Constantsยง

DEFAULT_LOG_DIR ๐Ÿ”’
DEFAULT_LOG_DIRECTIVES
Default tracing filter. info baseline keeps signal-to-noise sensible; the targets at debug are the ones we actually stare at when triaging UI/event drops (input submission, the bridge connect path). agent.env_git is there for a second reason: a git probe missing refs/remotes/origin/HEAD is real and is not forgeโ€™s problem. At debug it stays readable without raising a warning that says forge is unwell. forge_workspace::output_tail is there for the same reason: a line in a commandโ€™s output file that cannot be decoded is the watched commandโ€™s own output rather than a problem with forge. (forge_server too: its session reads are one sessionโ€™s own work.)
DEFAULT_LOG_FILE_NAME ๐Ÿ”’
GLOBAL_SLOT_KEY ๐Ÿ”’
No target can be empty, so this key collides with no real slot: every bare level token shares it, because the parser resolves them all to the filterโ€™s one global directive and the level is not part of that slotโ€™s identity.
LOG_ROTATION_MAX_BYTES ๐Ÿ”’
LOG_ROTATION_MAX_FILES ๐Ÿ”’

Functionsยง

build_filter_directives ๐Ÿ”’
clear_rotated_files ๐Ÿ”’
compose_filter_directives ๐Ÿ”’
The two directive lists composed into one, a directive both name kept once - the presetโ€™s copy, whatever level it sets - so a default never overrides a slot the preset names. The presetโ€™s own order leads; the defaultsโ€™ directives it did not name follow.
default_diagnostics_dir ๐Ÿ”’
The directory forgeโ€™s own logs live in, which a clientโ€™s perf log shares.
default_log_path ๐Ÿ”’
directive_key ๐Ÿ”’
A directiveโ€™s slot in the filter, the part two directives naming the same slot collide on. A bare level token (info, 4, a case variant) is the global directive, which every bare level shares. Anything else keys by its target, cut at the = the parser would use: the first one outside a brace shape.
open_log_file ๐Ÿ”’
preset_extending_defaults ๐Ÿ”’
The presetโ€™s directives with the default set composed in, so a preset extends the always-on coverage rather than replacing it: a target that only the defaults name stays readable under every preset.
resolve_log_path ๐Ÿ”’
rotate_file_window ๐Ÿ”’
rotated_log_path ๐Ÿ”’