pub struct PromptLogConfig {
pub enabled: bool,
pub dir: PathBuf,
pub max_bytes: u64,
pub retention_days: u32,
pub hash_prompts: bool,
}Expand description
Configuration for PromptLogger.
Why: keeps env-parsing out of the hot path and allows tests to construct
loggers directly without mutating process-wide env state. The struct is
Clone so a logger can be cheaply re-derived per invocation.
What: holds the resolved log directory, size cap, retention window, and
privacy toggles. enabled = false short-circuits every write.
Test: covered by config_from_env_disabled and the integration tests.
Fields§
§enabled: boolMaster enable switch. false → every method is a no-op.
dir: PathBufDirectory holding the rolling log files (created lazily on first write).
max_bytes: u64Per-file size cap; the writer rolls to a new numeric suffix when the active file would exceed this size.
retention_days: u32Retention window in days. Files older than this are pruned on the first write of each day.
hash_prompts: boolReplace trigger_prompt field bodies with sha256:<hex> when true.
Implementations§
Source§impl PromptLogConfig
impl PromptLogConfig
Sourcepub fn from_env_with_root(data_root: &Path) -> Self
pub fn from_env_with_root(data_root: &Path) -> Self
Build a config rooted at the supplied data_root and overlayed with
env vars.
Why: prompt-context and inbox-check both resolve their data root
via trusty_common::resolve_data_dir but only that caller knows the
app name. Accepting an explicit root lets the logger reuse the same
resolution without parsing dirs::data_dir twice.
What: defaults dir = data_root/logs; overrides via TRUSTY_MEMORY_*
envs. enabled defaults to true; flips to false when
TRUSTY_MEMORY_PROMPT_LOG is set to an off-value.
Test: config_from_env_defaults, config_from_env_disabled,
config_from_env_overrides_dir.
Trait Implementations§
Source§impl Clone for PromptLogConfig
impl Clone for PromptLogConfig
Source§fn clone(&self) -> PromptLogConfig
fn clone(&self) -> PromptLogConfig
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreAuto Trait Implementations§
impl Freeze for PromptLogConfig
impl RefUnwindSafe for PromptLogConfig
impl Send for PromptLogConfig
impl Sync for PromptLogConfig
impl Unpin for PromptLogConfig
impl UnsafeUnpin for PromptLogConfig
impl UnwindSafe for PromptLogConfig
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more