Compare commits

..

No commits in common. "a35ca706c52b3be52750b991c0c2f82e05835599" and "3bf60f86b1424415c99b4216421395dcec9216ee" have entirely different histories.

4 changed files with 6 additions and 18 deletions

View file

@ -21,7 +21,7 @@ anyhow = "1.0.79"
thiserror = "1.0.56" thiserror = "1.0.56"
libpt-core = { version = "0.5.0", path = "members/libpt-core" } libpt-core = { version = "0.5.0", path = "members/libpt-core" }
libpt-bintols = { version = "0.5.1", path = "members/libpt-bintols" } libpt-bintols = { version = "0.5.1", path = "members/libpt-bintols" }
libpt-log = { version = "0.6.1", path = "members/libpt-log" } libpt-log = { version = "0.6.0", path = "members/libpt-log" }
libpt-cli = { version = "0.2.1", path = "members/libpt-cli" } libpt-cli = { version = "0.2.1", path = "members/libpt-cli" }
[package] [package]

View file

@ -1,7 +1,7 @@
[package] [package]
name = "libpt-log" name = "libpt-log"
publish.workspace = true publish.workspace = true
version = "0.6.1" version = "0.6.0"
edition.workspace = true edition.workspace = true
authors.workspace = true authors.workspace = true
license.workspace = true license.workspace = true

View file

@ -17,7 +17,7 @@ pub enum Error {
/// Could not assign logger as the global default /// Could not assign logger as the global default
#[error("Could not assign logger as global default")] #[error("Could not assign logger as global default")]
SetGlobalDefaultFail(#[from] SetGlobalDefaultError), SetGlobalDefaultFail(#[from] SetGlobalDefaultError),
/// any other error type, wrapped in [anyhow::Error] /// any other error type, wrapped in [anyhow::Error](anyhow::Error)
#[error(transparent)] #[error(transparent)]
Other(#[from] anyhow::Error), Other(#[from] anyhow::Error),
} }

View file

@ -61,7 +61,7 @@ static INITIALIZED: AtomicBool = AtomicBool::new(false);
/// # } /// # }
/// ///
/// ``` /// ```
#[derive(PartialEq, Eq, PartialOrd, Ord, Debug)] #[derive(PartialEq, Eq, PartialOrd, Ord, Hash, Debug)]
#[allow(clippy::struct_excessive_bools)] // it's just true/false values, not states, and I don't #[allow(clippy::struct_excessive_bools)] // it's just true/false values, not states, and I don't
// need to reinvent the wheel // need to reinvent the wheel
pub struct LoggerBuilder { pub struct LoggerBuilder {
@ -94,8 +94,6 @@ pub struct LoggerBuilder {
show_time: bool, show_time: bool,
/// show timestamps as uptime (duration since the logger was initialized) /// show timestamps as uptime (duration since the logger was initialized)
uptime: bool, uptime: bool,
/// log when span things happen
span_events: FmtSpan,
} }
impl LoggerBuilder { impl LoggerBuilder {
@ -145,7 +143,7 @@ impl LoggerBuilder {
.with_thread_ids(self.display_thread_ids) .with_thread_ids(self.display_thread_ids)
.with_line_number(self.display_line_number) .with_line_number(self.display_line_number)
.with_thread_names(self.display_thread_names) .with_thread_names(self.display_thread_names)
.with_span_events(self.span_events); .with_span_events(FmtSpan::FULL);
// HACK: somehow find a better solution for this // HACK: somehow find a better solution for this
// I know this is hacky, but I couldn't get it any other way. I couldn't even find a // I know this is hacky, but I couldn't get it any other way. I couldn't even find a
// project that could do it any other way. You can't apply one after another, because the // project that could do it any other way. You can't apply one after another, because the
@ -349,15 +347,6 @@ impl LoggerBuilder {
self.max_level = max_level; self.max_level = max_level;
self self
} }
/// set how span events are handled
///
/// Default: [`FmtSpan::NONE`]
#[must_use]
pub const fn span_events(mut self, span_events: FmtSpan) -> Self {
self.span_events = span_events;
self
}
} }
impl Default for LoggerBuilder { impl Default for LoggerBuilder {
@ -376,12 +365,11 @@ impl Default for LoggerBuilder {
pretty: false, pretty: false,
show_time: true, show_time: true,
uptime: false, uptime: false,
span_events: FmtSpan::NONE,
} }
} }
} }
/// ## Logger for `libpt` /// ## Logger for [`pt`](libpt)
/// ///
/// A logger is generally a functionality that let's you write information from your library or /// A logger is generally a functionality that let's you write information from your library or
/// application in a more structured manner than if you just wrote all information to `stdout` or /// application in a more structured manner than if you just wrote all information to `stdout` or