Skip to content

Commit 695cde9

Browse files
committed
chore: update with latest log crate
1 parent 995f1ee commit 695cde9

File tree

12 files changed

+32
-56
lines changed

12 files changed

+32
-56
lines changed

.github/workflows/ci.yml

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -13,12 +13,7 @@ jobs:
1313
toolchain: [stable, nightly]
1414
continue-on-error: true
1515
steps:
16-
- uses: actions/checkout@v3
17-
- uses: actions-rs/toolchain@v1
18-
with:
19-
toolchain: stable
20-
override: false
21-
components: rustfmt, clippy
16+
- uses: actions/checkout@v4
2217
- name: Run clippy
2318
run: cargo clippy --all-targets --all-features
2419
- name: Run tests

.github/workflows/publish.yml

Lines changed: 1 addition & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -7,29 +7,7 @@ jobs:
77
publish:
88
runs-on: ubuntu-latest
99
steps:
10-
- uses: actions/checkout@v3
11-
- uses: actions-rs/toolchain@v1
12-
with:
13-
toolchain: nightly
14-
override: true
15-
components: rustfmt, clippy
16-
- uses: actions-rs/cargo@v1
17-
with:
18-
command: test
19-
args: --all-features --no-fail-fast -- --nocapture --test-threads=1
20-
env:
21-
CARGO_INCREMENTAL: '0'
22-
RUSTFLAGS: '-Zprofile -Ccodegen-units=1 -Cinline-threshold=0 -Clink-dead-code -Coverflow-checks=off -Cpanic=abort -Zpanic_abort_tests'
23-
RUSTDOCFLAGS: '-Zprofile -Ccodegen-units=1 -Cinline-threshold=0 -Clink-dead-code -Coverflow-checks=off -Cpanic=abort -Zpanic_abort_tests'
24-
- uses: actions-rs/[email protected]
25-
- name: Upload coverage to Codecov
26-
uses: codecov/codecov-action@v3
27-
with:
28-
token: ${{ secrets.CODECOV_TOKEN }}
29-
files: ${{ steps.coverage.outputs.report }}
30-
flags: unittests
31-
name: codecov-umbrella
32-
verbose: true
10+
- uses: actions/checkout@v4
3311
- uses: katyo/publish-crates@v2
3412
with:
3513
registry-token: ${{ secrets.CARGO_REGISTRY_TOKEN }}

Cargo.toml

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "structured-logger"
3-
version = "1.0.3"
3+
version = "1.0.4"
44
edition = "2018"
55
description = """
66
A logging implementation for the log crate that logs structured values either synchronous or asynchronous, as JSON, CBOR, or any other format, into a file, stderr, stdout, or any other destination.
@@ -26,13 +26,11 @@ default = ["log-panic"]
2626
log-panic = []
2727

2828
[dependencies]
29-
log = { version = "0.4", features = [
30-
"kv_unstable_serde",
31-
], default-features = false }
29+
log = { version = "0.4", features = ["kv_serde"], default-features = false }
3230
parking_lot = { version = "0.12", optional = false }
33-
serde = { version = "1.0", features = ["derive"], default-features = false }
34-
serde_json = { version = "1.0", features = ["std"], default-features = false }
35-
tokio = { version = "1.29", features = [
31+
serde = { version = "1", features = ["derive"], default-features = false }
32+
serde_json = { version = "1", features = ["std"], default-features = false }
33+
tokio = { version = "1", features = [
3634
"io-std",
3735
"io-util",
3836
"parking_lot",
@@ -41,5 +39,5 @@ tokio = { version = "1.29", features = [
4139
], default-features = false }
4240

4341
[dev-dependencies]
44-
tokio = { version = "1.29", features = ["full"] }
45-
gag = { version = "1.0" }
42+
tokio = { version = "1", features = ["full"] }
43+
gag = { version = "1" }

Makefile

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,9 @@ lint:
1010
@cargo fmt
1111
@cargo clippy --all-targets --all-features
1212

13+
fix:
14+
@cargo clippy --fix --workspace --tests
15+
1316
test:
1417
@cargo fmt
1518
@cargo clippy --all-targets --all-features

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ async fn main() {
4444
status = 200_u16,
4545
start = unix_ms(),
4646
elapsed = 10_u64,
47-
kv = log::as_serde!(kv);
47+
kv:serde = kv;
4848
"",
4949
);
5050
// This log will be written to stdout:

examples/async_log.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ async fn main() {
2727
status = 200_u16,
2828
start = unix_ms(),
2929
elapsed = 10_u64,
30-
kv = log::as_serde!(kv);
30+
kv:serde = kv;
3131
"",
3232
);
3333
// This log will be written to tokio stdout (async writer):

examples/custom.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ fn main() {
3434
status = 200_u16,
3535
start = unix_ms(),
3636
elapsed = 10_u64,
37-
kv = log::as_serde!(kv);
37+
kv:serde = kv;
3838
"",
3939
);
4040
// This log will be written to stdout:
@@ -46,7 +46,7 @@ fn main() {
4646
status = 200_u16,
4747
start = unix_ms(),
4848
elapsed = 10_u64,
49-
kv = log::as_serde!(kv);
49+
kv:serde = kv;
5050
"",
5151
);
5252
// This log will be written to file "app.log":

examples/simple.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ async fn main() {
2323
status = 200_u16,
2424
start = unix_ms(),
2525
elapsed = 10_u64,
26-
kv = log::as_serde!(kv);
26+
kv:serde = kv;
2727
"",
2828
);
2929
// This log will be written to stdout:

src/async_json.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ impl<W: AsyncWrite + Sync + Send + 'static> Writer for AsyncJSONWriter<W> {
3333
let mut buf = Vec::with_capacity(256);
3434
serde_json::to_writer(&mut buf, value).map_err(io::Error::from)?;
3535
// must write the LINE FEED character.
36-
buf.write_all(b"\n").map_err(io::Error::from)?;
36+
buf.write_all(b"\n")?;
3737

3838
let w = self.0.clone();
3939
tokio::spawn(async move {

src/json.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,11 +30,11 @@ impl<W: Write + Sync + Send + 'static> Writer for JSONWriter<W> {
3030
let mut buf = Vec::with_capacity(256);
3131
serde_json::to_writer(&mut buf, value).map_err(io::Error::from)?;
3232
// must write the LINE FEED character.
33-
buf.write_all(b"\n").map_err(io::Error::from)?;
33+
buf.write_all(b"\n")?;
3434

3535
let w = self.0.lock();
3636
if let Ok(mut w) = w.try_borrow_mut() {
37-
w.as_mut().write_all(&buf).map_err(io::Error::from)?;
37+
w.as_mut().write_all(&buf)?;
3838
} else {
3939
// should never happen, but if it does, we log it.
4040
log_failure("JSONWriter failed to write log: writer already borrowed");

0 commit comments

Comments
 (0)