Compare commits

..

6 commits

Author SHA1 Message Date
05910ae3be docs: add backtics
Some checks failed
cargo devel CI / cargo CI (push) Has been cancelled
2024-09-07 23:51:19 +02:00
35ab3d9b28 chore: fix publish script
All checks were successful
cargo devel CI / cargo CI (push) Successful in 2m1s
2024-09-07 23:49:15 +02:00
917a68c8ab chore: bump versions
Some checks failed
cargo devel CI / cargo CI (push) Has been cancelled
2024-09-07 23:48:22 +02:00
5b0c82cf2b feat(log): specify span events + doc fixes 2024-09-07 23:47:06 +02:00
3bf60f86b1 Merge branch 'devel'
All checks were successful
cargo devel CI / cargo CI (push) Successful in 1m54s
2024-09-06 17:34:20 +02:00
d48b87dcfe Merge pull request 'idk why this isn't in master yet' (#94) from devel into master
All checks were successful
cargo devel CI / cargo CI (push) Successful in 1m59s
Reviewed-on: #94
2024-07-22 13:30:20 +02:00
5 changed files with 20 additions and 11 deletions

View file

@ -5,7 +5,7 @@ default-members = [".", "members/libpt-core"]
[workspace.package]
publish = true
version = "0.7.1"
version = "0.7.2"
edition = "2021"
authors = ["Christoph J. Scherr <software@cscherr.de>"]
license = "GPL-3.0-or-later"
@ -21,7 +21,7 @@ anyhow = "1.0.79"
thiserror = "1.0.56"
libpt-core = { version = "0.5.0", path = "members/libpt-core" }
libpt-bintols = { version = "0.5.1", path = "members/libpt-bintols" }
libpt-log = { version = "0.6.0", path = "members/libpt-log" }
libpt-log = { version = "0.6.1", path = "members/libpt-log" }
libpt-cli = { version = "0.2.1", path = "members/libpt-cli" }
[package]

View file

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

View file

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

View file

@ -61,7 +61,7 @@ static INITIALIZED: AtomicBool = AtomicBool::new(false);
/// # }
///
/// ```
#[derive(PartialEq, Eq, PartialOrd, Ord, Hash, Debug)]
#[derive(PartialEq, Eq, PartialOrd, Ord, Debug)]
#[allow(clippy::struct_excessive_bools)] // it's just true/false values, not states, and I don't
// need to reinvent the wheel
pub struct LoggerBuilder {
@ -94,6 +94,8 @@ pub struct LoggerBuilder {
show_time: bool,
/// show timestamps as uptime (duration since the logger was initialized)
uptime: bool,
/// log when span things happen
span_events: FmtSpan,
}
impl LoggerBuilder {
@ -143,7 +145,7 @@ impl LoggerBuilder {
.with_thread_ids(self.display_thread_ids)
.with_line_number(self.display_line_number)
.with_thread_names(self.display_thread_names)
.with_span_events(FmtSpan::FULL);
.with_span_events(self.span_events);
// 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
// project that could do it any other way. You can't apply one after another, because the
@ -347,6 +349,15 @@ impl LoggerBuilder {
self.max_level = max_level;
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 {
@ -365,11 +376,12 @@ impl Default for LoggerBuilder {
pretty: false,
show_time: true,
uptime: false,
span_events: FmtSpan::NONE,
}
}
}
/// ## Logger for [`pt`](libpt)
/// ## Logger for `libpt`
///
/// 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

View file

@ -1,9 +1,6 @@
#!/bin/bash
set -e
cargo check --all-features
echo ">>>>>>>> SELECT A NEW VERSION"
cargo ws version
NEW_VERSION=$(cat Cargo.toml | rg '^\s*version\s*=\s*"([^"]*)"\s*$' -or '$1')
cargo check --all-features --workspace
echo ">>>>>>>> PUBLISHING RELEASE FOR REPO"
bash scripts/release.sh
echo ">>>>>>>> PUBLISHING TO CRATES.IO NEXT"