Browse Source

fix: clear buffer

main v0.1.1
xenua 7 months ago
parent
commit
2013219ac7
Signed by: xenua
GPG Key ID: 8F93B68BD37255B8
  1. 45
      Cargo.lock
  2. 10
      Cargo.toml
  3. 8
      src/lib.rs

45
Cargo.lock generated

@ -31,9 +31,9 @@ checksum = "79296716171880943b8470b5f8d03aa55eb2e645a4874bdbb28adb49162e012c" @@ -31,9 +31,9 @@ checksum = "79296716171880943b8470b5f8d03aa55eb2e645a4874bdbb28adb49162e012c"
[[package]]
name = "cc"
version = "1.0.92"
version = "1.0.94"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "2678b2e3449475e95b0aa6f9b506a28e61b3dc8996592b983695e8ebb58a8b41"
checksum = "17f6e324229dc011159fcc089755d1e2e216a90d43a7dea6853ca740b84f35e7"
[[package]]
name = "cfg-if"
@ -63,7 +63,7 @@ checksum = "06ea2b9bc92be3c2baa9334a323ebca2d6f074ff852cd1d7b11064035cd3868f" @@ -63,7 +63,7 @@ checksum = "06ea2b9bc92be3c2baa9334a323ebca2d6f074ff852cd1d7b11064035cd3868f"
[[package]]
name = "gay_tracing_formatter"
version = "0.1.0"
version = "0.1.1"
dependencies = [
"chrono",
"owo-colors",
@ -374,13 +374,14 @@ dependencies = [ @@ -374,13 +374,14 @@ dependencies = [
[[package]]
name = "windows-targets"
version = "0.52.4"
version = "0.52.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "7dd37b7e5ab9018759f893a1952c9420d060016fc19a472b4bb20d1bdd694d1b"
checksum = "6f0713a46559409d202e70e28227288446bf7841d3211583a4b53e3f6d96e7eb"
dependencies = [
"windows_aarch64_gnullvm",
"windows_aarch64_msvc",
"windows_i686_gnu",
"windows_i686_gnullvm",
"windows_i686_msvc",
"windows_x86_64_gnu",
"windows_x86_64_gnullvm",
@ -389,42 +390,48 @@ dependencies = [ @@ -389,42 +390,48 @@ dependencies = [
[[package]]
name = "windows_aarch64_gnullvm"
version = "0.52.4"
version = "0.52.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "bcf46cf4c365c6f2d1cc93ce535f2c8b244591df96ceee75d8e83deb70a9cac9"
checksum = "7088eed71e8b8dda258ecc8bac5fb1153c5cffaf2578fc8ff5d61e23578d3263"
[[package]]
name = "windows_aarch64_msvc"
version = "0.52.4"
version = "0.52.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "da9f259dd3bcf6990b55bffd094c4f7235817ba4ceebde8e6d11cd0c5633b675"
checksum = "9985fd1504e250c615ca5f281c3f7a6da76213ebd5ccc9561496568a2752afb6"
[[package]]
name = "windows_i686_gnu"
version = "0.52.4"
version = "0.52.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "88ba073cf16d5372720ec942a8ccbf61626074c6d4dd2e745299726ce8b89670"
[[package]]
name = "windows_i686_gnullvm"
version = "0.52.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "b474d8268f99e0995f25b9f095bc7434632601028cf86590aea5c8a5cb7801d3"
checksum = "87f4261229030a858f36b459e748ae97545d6f1ec60e5e0d6a3d32e0dc232ee9"
[[package]]
name = "windows_i686_msvc"
version = "0.52.4"
version = "0.52.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "1515e9a29e5bed743cb4415a9ecf5dfca648ce85ee42e15873c3cd8610ff8e02"
checksum = "db3c2bf3d13d5b658be73463284eaf12830ac9a26a90c717b7f771dfe97487bf"
[[package]]
name = "windows_x86_64_gnu"
version = "0.52.4"
version = "0.52.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "5eee091590e89cc02ad514ffe3ead9eb6b660aedca2183455434b93546371a03"
checksum = "4e4246f76bdeff09eb48875a0fd3e2af6aada79d409d33011886d3e1581517d9"
[[package]]
name = "windows_x86_64_gnullvm"
version = "0.52.4"
version = "0.52.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "77ca79f2451b49fa9e2af39f0747fe999fcda4f5e241b2898624dca97a1f2177"
checksum = "852298e482cd67c356ddd9570386e2862b5673c85bd5f88df9ab6802b334c596"
[[package]]
name = "windows_x86_64_msvc"
version = "0.52.4"
version = "0.52.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "32b752e52a2da0ddfbdbcc6fceadfeede4c939ed16d13e648833a61dfb611ed8"
checksum = "bec47e5bfd1bff0eeaf6d8b485cc1074891a197ab4225d504cb7a1ab88b02bf0"

10
Cargo.toml

@ -1,10 +1,10 @@ @@ -1,10 +1,10 @@
[package]
name = "gay_tracing_formatter"
version = "0.1.0"
version = "0.1.1"
edition = "2021"
[dependencies]
chrono = "0.4.37"
owo-colors = "4.0.0"
tracing = "0.1.40"
tracing-subscriber = "0.3.18"
chrono = "0.4"
owo-colors = "4.0"
tracing = "0.1"
tracing-subscriber = "0.3"

8
src/lib.rs

@ -58,7 +58,7 @@ where @@ -58,7 +58,7 @@ where
{
fn on_event(&self, event: &Event<'_>, _ctx: tracing_subscriber::layer::Context<'_, S>) {
thread_local! {
static BUF: RefCell<String> = RefCell::new(String::new());
static BUF: RefCell<String> = const { RefCell::new(String::new()) };
}
BUF.with(|buf: &RefCell<String>| {
@ -90,6 +90,8 @@ where @@ -90,6 +90,8 @@ where
event.fields()
);
}
buf.clear();
});
}
}
@ -223,7 +225,7 @@ where @@ -223,7 +225,7 @@ where
const TIME_LEN: usize = "YYYY-MM-DD HH-MM-SS".len();
fn make_from_crate_string(&self, meta: &Metadata<'static>) -> Option<String> {
static CURRENT_CRATE_NAME: &'static str = env!("CARGO_PKG_NAME");
static CURRENT_CRATE_NAME: &str = env!("CARGO_PKG_NAME");
match meta.module_path() {
Some(path) => path
.split_once("::")
@ -258,7 +260,7 @@ where @@ -258,7 +260,7 @@ where
event.record(&mut v);
write!(writer, "\n")?;
writeln!(writer)?;
Ok(())
}

Loading…
Cancel
Save