Skip to content

Commit ca449f1

Browse files
author
Jonathan Woollett-Light
committed
feat: Replace log with tracing
Replaces `log` with `tracing` and the custom logger with `tracing_subscriber::Fmt`. Adding support for re-configuring the logger at run-time and removing the old logger format. Signed-off-by: Jonathan Woollett-Light <jcawl@amazon.co.uk>
1 parent 99c6292 commit ca449f1

File tree

24 files changed

+651
-2126
lines changed

24 files changed

+651
-2126
lines changed

Cargo.lock

Lines changed: 139 additions & 12 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/api_server/Cargo.toml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,8 @@ mmds = { path = "../mmds" }
2121
seccompiler = { path = "../seccompiler" }
2222
utils = { path = "../utils" }
2323
vmm = { path = "../vmm" }
24+
tracing = "0.1.37"
2425

2526
[dev-dependencies]
2627
libc = "0.2.117"
28+
log = "0.4.19"

src/api_server/src/parsed_request.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33

44
use std::fmt::Debug;
55

6-
use logger::{error, info, log_enabled, Level};
6+
use logger::{error, info, Level};
77
use micro_http::{Body, Method, Request, Response, StatusCode, Version};
88
use serde::ser::Serialize;
99
use serde_json::Value;
@@ -232,7 +232,7 @@ fn describe(method: Method, path: &str, body: Option<&Body>) -> String {
232232
("/cpu-config", Some(payload_value)) => {
233233
// If the log level is at Debug or higher, include the CPU template in
234234
// the log line.
235-
if log_enabled!(Level::Debug) {
235+
if tracing::enabled!(Level::DEBUG) {
236236
describe_with_body(method, path, payload_value)
237237
} else {
238238
format!(

0 commit comments

Comments
 (0)