Skip to content

Commit c679302

Browse files
committed
docs: address minor documentation cleanup
1 parent c3693d9 commit c679302

File tree

2 files changed

+20
-8
lines changed

2 files changed

+20
-8
lines changed

src/builder.rs

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -348,7 +348,7 @@ impl NodeBuilder {
348348
self
349349
}
350350

351-
/// Configures the [`Node`] instance to write logs to the provided custom log writer.
351+
/// Configures the [`Node`] instance to write logs to the provided custom [`LogWriter`].
352352
pub fn set_custom_logger(&mut self, log_writer: Arc<dyn LogWriter>) -> &mut Self {
353353
self.log_writer_config = Some(LogWriterConfig::Custom(log_writer));
354354
self
@@ -655,20 +655,23 @@ impl ArcedNodeBuilder {
655655
self.inner.write().unwrap().set_storage_dir_path(storage_dir_path);
656656
}
657657

658-
/// Configures the [`Node`] instance to write logs to the filesystem with an optional
659-
/// `file_path` and `log_level` arguments.
658+
/// Configures the [`Node`] instance to write logs to the filesystem.
659+
///
660+
/// The `log_file_path` defaults to the [`DEFAULT_LOG_FILENAME`] in the default
661+
/// storage directory if set to None.
662+
/// The `log_level` defaults to [`DEFAULT_LOG_LEVEL`] if set to None.
660663
pub fn set_filesystem_logger(
661664
&self, log_file_path: Option<String>, log_level: Option<LogLevel>,
662665
) {
663666
self.inner.write().unwrap().set_filesystem_logger(log_file_path, log_level);
664667
}
665668

666-
/// Configures the [`Node`] instance to write logs to the `log` facade.
669+
/// Configures the [`Node`] instance to write logs to the [`log`](https://crates.io/crates/log) facade.
667670
pub fn set_log_facade_logger(&self, log_level: LogLevel) {
668671
self.inner.write().unwrap().set_log_facade_logger(log_level);
669672
}
670673

671-
/// Configures the [`Node`] instance to write logs to the provided custom log writer.
674+
/// Configures the [`Node`] instance to write logs to the provided custom [`LogWriter`].
672675
pub fn set_custom_logger(&self, log_writer: Arc<dyn LogWriter>) {
673676
self.inner.write().unwrap().set_custom_logger(log_writer);
674677
}
@@ -1298,7 +1301,7 @@ fn build_with_store_internal(
12981301
/// Sets up the node logger.
12991302
///
13001303
/// If `log_writer_conf` is set to None, uses [`LogWriterConfig::default()`].
1301-
/// The `node_conf`is provided to access the configured storage directory.
1304+
/// The `node_conf` is provided to access the configured storage directory.
13021305
fn setup_logger(
13031306
log_writer_conf: &Option<LogWriterConfig>, node_conf: &Config,
13041307
) -> Result<Arc<Logger>, BuildError> {

src/logger.rs

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,8 @@ use std::io::Write;
2222
use std::path::Path;
2323
use std::sync::Arc;
2424

25-
/// A unit of logging output with Metadata to enable filtering module_path,
26-
/// file, line to inform on log's source.
25+
/// A unit of logging output with metadata to enable filtering `module_path`,
26+
/// `file`, and `line` to inform on log's source.
2727
#[cfg(not(feature = "uniffi"))]
2828
pub struct LogRecord<'a> {
2929
/// The verbosity level of the message.
@@ -36,6 +36,12 @@ pub struct LogRecord<'a> {
3636
pub line: u32,
3737
}
3838

39+
/// A unit of logging output with metadata to enable filtering `module_path`,
40+
/// `file`, and `line` to inform on log's source.
41+
///
42+
/// This version is used when the `uniffi` feature is enabled.
43+
/// It is similar to the non-`uniffi` version, but it omits the lifetime parameter
44+
/// for the `LogRecord`, as the Uniffi-exposed interface cannot handle lifetimes.
3945
#[cfg(feature = "uniffi")]
4046
pub struct LogRecord {
4147
/// The verbosity level of the message.
@@ -85,6 +91,9 @@ pub trait LogWriter: Send + Sync {
8591

8692
/// Defines the behavior required for writing log records.
8793
///
94+
/// Implementors of this trait are responsible for handling log messages,
95+
/// which may involve formatting, filtering, and forwarding them to specific
96+
/// outputs.
8897
/// This version is used when the `uniffi` feature is enabled.
8998
/// It is similar to the non-`uniffi` version, but it omits the lifetime parameter
9099
/// for the `LogRecord`, as the Uniffi-exposed interface cannot handle lifetimes.

0 commit comments

Comments
 (0)