Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 5 additions & 2 deletions appenders/async/src/worker.rs
Original file line number Diff line number Diff line change
Expand Up @@ -43,8 +43,11 @@ impl Worker {
record,
diags,
} => {
let diags: Vec<Box<dyn Diagnostic>> = vec![Box::new(OwnedDiagnostic(diags))];
let diags = diags.as_slice();
let diags: &[Box<dyn Diagnostic>] = if diags.is_empty() {
&[]
} else {
&[Box::new(OwnedDiagnostic(diags))]
};
let record = record.as_record();
for append in appends.iter() {
if let Err(err) = append.append(&record, diags) {
Expand Down
2 changes: 1 addition & 1 deletion core/src/diagnostic/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@

//! Mapped Diagnostic Context (MDC).
//!
//! A lighter technique consists of uniquely stamping each log request.
//! A light-weight technique for stamping log request.

use std::fmt;

Expand Down
2 changes: 1 addition & 1 deletion core/src/diagnostic/static_global.rs
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ use crate::kv::Visitor;
/// use logforth_core::diagnostic::StaticDiagnostic;
///
/// let mut diagnostic = StaticDiagnostic::default();
/// diagnostic.insert("key", "value");
/// diagnostic.insert("app_name", "acme");
/// ```
#[derive(Default, Debug, Clone)]
#[non_exhaustive]
Expand Down
10 changes: 7 additions & 3 deletions logforth/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -30,10 +30,10 @@
//!
//! # Examples
//!
//! Simple setup with default stdout appender:
//! Simple setup with a stderr appender:
//!
//! ```
//! logforth::starter_log::stdout().apply();
//! logforth::starter_log::stderr().apply();
//!
//! log::info!("This is an info message.");
//! ```
Expand All @@ -59,6 +59,10 @@
//! log::error!("Error message.");
//! log::info!("Info message.");
//! ```
//!
//! See the [README] file for more details and examples.
//!
//! [README]: https://github.com/fast/logforth?tab=readme-ov-file

#![cfg_attr(docsrs, feature(doc_cfg))]

Expand Down Expand Up @@ -99,7 +103,7 @@ pub mod append {
pub mod bridge {
/// Bridge logforth with [`log`].
///
/// [`log`]: https://docs.rs/log/
/// [`log`]: https://docs.rs/log
#[cfg(feature = "bridge-log")]
pub mod log {
#[cfg(feature = "bridge-log")]
Expand Down