pub struct Logger { /* private fields */ }Expand description
Append-only telemetry logger.
Construct with Logger::new. When logging is disabled or cannot be
initialized, new returns None.
Implementations§
Source§impl Logger
impl Logger
Sourcepub fn new(
config_dir: Option<PathBuf>,
project_root: &Path,
ito_path: Option<&Path>,
command_id: &str,
ito_version: &str,
) -> Option<Self>
pub fn new( config_dir: Option<PathBuf>, project_root: &Path, ito_path: Option<&Path>, command_id: &str, ito_version: &str, ) -> Option<Self>
Create a logger if telemetry is enabled.
Returns None when:
- telemetry is disabled (
ITO_DISABLE_LOGGING) - the config directory is not available
- the telemetry salt cannot be read/created
Sourcepub fn session_id(&self) -> &str
pub fn session_id(&self) -> &str
Session identifier for this execution.
When an .ito/ directory exists, this is persisted in
.ito/session.json to allow grouping commands across runs.
Sourcepub fn project_id(&self) -> &str
pub fn project_id(&self) -> &str
Stable anonymized project identifier.
This is derived from project_root using a per-user random salt.
Sourcepub fn write_start(&self)
pub fn write_start(&self)
Write a command_start event.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Logger
impl RefUnwindSafe for Logger
impl Send for Logger
impl Sync for Logger
impl Unpin for Logger
impl UnsafeUnpin for Logger
impl UnwindSafe for Logger
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
Mutably borrows from an owned value. Read more