Skip to content

Commit 283fe85

Browse files
committed
docs: clarify and improve LogWriter documentation for feature-based behavior
- Removed trait name in description. - Expanded the description of the `LogWriter` trait to clarify its behavior when the `uniffi` feature is enabled or disabled. - Improved explanation of the trait’s responsibilities, including handling log messages and forwarding to outputs.
1 parent f32d7e8 commit 283fe85

File tree

1 file changed

+10
-2
lines changed

1 file changed

+10
-2
lines changed

src/logger.rs

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -73,14 +73,22 @@ impl<'a> From<Record<'a>> for LogRecord<'a> {
7373
}
7474
}
7575

76-
/// LogWriter trait encapsulating the operations required of a
77-
/// logger's writer.
76+
/// Defines the behavior required for writing log records.
77+
///
78+
/// Implementors of this trait are responsible for handling log messages,
79+
/// which may involve formatting, filtering, and forwarding them to specific
80+
/// outputs.
7881
#[cfg(not(feature = "uniffi"))]
7982
pub trait LogWriter: Send + Sync + Debug {
8083
/// Log the record.
8184
fn log<'a>(&self, record: LogRecord<'a>);
8285
}
8386

87+
/// Defines the behavior required for writing log records.
88+
///
89+
/// This version is used when the `uniffi` feature is enabled.
90+
/// It is similar to the non-`uniffi` version, but it omits the lifetime parameter
91+
/// for the `LogRecord`, as the Uniffi-exposed interface cannot handle lifetimes.
8492
#[cfg(feature = "uniffi")]
8593
pub trait LogWriter: Send + Sync + Debug {
8694
/// Log the record.

0 commit comments

Comments
 (0)