Skip to content

Commit e67d59f

Browse files
miguelfrdeCQ Bot
authored andcommitted
[starnix] Use Rust log instead of tracing
Context at: http://go/fuchsia-rust-log Bug: 344980783 Change-Id: I41c7236637b5ffbf7c27328c6014ffee9082167e Reviewed-on: https://fuchsia-review.googlesource.com/c/fuchsia/+/1178822 Fuchsia-Auto-Submit: Miguel Flores <[email protected]> Reviewed-by: Adam Perry <[email protected]> Commit-Queue: Auto-Submit <[email protected]>
1 parent 86eb16f commit e67d59f

File tree

48 files changed

+177
-167
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

48 files changed

+177
-167
lines changed

src/starnix/examples/hello_debian/BUILD.gn

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,6 @@ rustc_binary("hello_debian_verifier") {
4242
"//third_party/rust_crates:argh",
4343
"//third_party/rust_crates:assert_matches",
4444
"//third_party/rust_crates:futures",
45-
"//third_party/rust_crates:tracing",
45+
"//third_party/rust_crates:log",
4646
]
4747
}

src/starnix/examples/hello_debian/hello_debian_verifier.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ use component_events::matcher::EventMatcher;
99
use diagnostics_reader::{ArchiveReader, Logs};
1010
use fuchsia_component_test::ScopedInstance;
1111
use futures::StreamExt;
12-
use tracing::info;
12+
use log::info;
1313

1414
/// verify the launch behavior of a hello debian binary
1515
#[derive(Debug, FromArgs)]

src/starnix/examples/hello_starnix/BUILD.gn

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ rustc_binary("hello_starnix_integration_test_bin") {
5050
"//src/sys/lib/component-events",
5151
"//third_party/rust_crates:assert_matches",
5252
"//third_party/rust_crates:futures",
53-
"//third_party/rust_crates:tracing",
53+
"//third_party/rust_crates:log",
5454
]
5555
}
5656

src/starnix/examples/hello_starnix/test.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ use component_events::matcher::EventMatcher;
88
use diagnostics_reader::{ArchiveReader, Logs};
99
use fuchsia_component_test::ScopedInstance;
1010
use futures::StreamExt;
11-
use tracing::info;
11+
use log::info;
1212

1313
#[fuchsia::main]
1414
async fn main() {

src/starnix/fakes/fake_lutex_controller/BUILD.gn

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ rustc_binary("bin") {
2121
"//src/lib/fuchsia-sync",
2222
"//third_party/rust_crates:anyhow",
2323
"//third_party/rust_crates:futures",
24-
"//third_party/rust_crates:tracing",
24+
"//third_party/rust_crates:log",
2525
]
2626
configs += [ "//src/starnix/config:starnix_clippy_lints" ]
2727
}

src/starnix/fakes/fake_lutex_controller/src/main.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,10 @@ use fuchsia_component::server::ServiceFs;
77
use fuchsia_sync::Mutex;
88
use futures::channel::oneshot;
99
use futures::{pin_mut, select, FutureExt, StreamExt, TryFutureExt, TryStreamExt};
10+
use log::{error, warn};
1011
use std::collections::BTreeMap;
1112
use std::future::Future;
1213
use std::sync::Arc;
13-
use tracing::{error, warn};
1414
use {
1515
fidl_fuchsia_posix as fposix, fidl_fuchsia_starnix_binder as fbinder, fuchsia_async as fasync,
1616
zx,

src/starnix/kernel/BUILD.gn

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -532,7 +532,6 @@ rustc_library("starnix_kernel_runner") {
532532
"//third_party/rust_crates:bstr",
533533
"//third_party/rust_crates:futures",
534534
"//third_party/rust_crates:rand",
535-
"//third_party/rust_crates:tracing",
536535
]
537536

538537
test_deps = [ "//src/lib/fuchsia" ]
@@ -568,8 +567,8 @@ rustc_library("starnix_logging") {
568567
"//third_party/rust_crates:anyhow",
569568
"//third_party/rust_crates:bstr",
570569
"//third_party/rust_crates:futures",
570+
"//third_party/rust_crates:log",
571571
"//third_party/rust_crates:regex",
572-
"//third_party/rust_crates:tracing",
573572
]
574573

575574
test_deps = [ "//third_party/rust_crates:pretty_assertions" ]

src/starnix/kernel/device/mem.rs

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -379,21 +379,21 @@ impl FileOps for DevKmsg {
379379
let bytes = data.read_all()?;
380380
let extract_result = syslog::extract_level(&bytes);
381381
let (level, msg_bytes) = match extract_result {
382-
None => (Level::INFO, bytes.as_slice()),
382+
None => (Level::Info, bytes.as_slice()),
383383
Some((level, bytes_after_level)) => match level {
384384
// An error but keep the <level> str.
385385
KmsgLevel::Emergency | KmsgLevel::Alert | KmsgLevel::Critical => {
386-
(Level::ERROR, bytes.as_slice())
386+
(Level::Error, bytes.as_slice())
387387
}
388-
KmsgLevel::Error => (Level::ERROR, bytes_after_level),
389-
KmsgLevel::Warning => (Level::WARN, bytes_after_level),
388+
KmsgLevel::Error => (Level::Error, bytes_after_level),
389+
KmsgLevel::Warning => (Level::Warn, bytes_after_level),
390390
// Log as info but show the <level>.
391-
KmsgLevel::Notice => (Level::INFO, bytes.as_slice()),
392-
KmsgLevel::Info => (Level::INFO, bytes_after_level),
393-
KmsgLevel::Debug => (Level::DEBUG, bytes_after_level),
391+
KmsgLevel::Notice => (Level::Info, bytes.as_slice()),
392+
KmsgLevel::Info => (Level::Info, bytes_after_level),
393+
KmsgLevel::Debug => (Level::Debug, bytes_after_level),
394394
},
395395
};
396-
log!(level, tag = "kmsg", "{}", String::from_utf8_lossy(msg_bytes).trim_end_matches('\n'));
396+
log!(level, tag = "kmsg"; "{}", String::from_utf8_lossy(msg_bytes).trim_end_matches('\n'));
397397
Ok(bytes.len())
398398
}
399399
}

src/starnix/kernel/execution/crash_reporter.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -142,10 +142,10 @@ impl CrashReporter {
142142
match reporter.file_report(crash_report).await {
143143
Ok(Ok(_)) => (),
144144
Ok(Err(filing_error)) => {
145-
log_error!(?filing_error, "Couldn't file crash report.");
145+
log_error!(filing_error:?; "Couldn't file crash report.");
146146
}
147147
Err(fidl_error) => log_warn!(
148-
?fidl_error,
148+
fidl_error:?;
149149
"Couldn't file crash report due to error on underlying channel."
150150
),
151151
};
@@ -155,12 +155,12 @@ impl CrashReporter {
155155
});
156156
} else {
157157
log_info!(
158-
?crash_report,
158+
crash_report:?;
159159
"Skipping sending crash report, too many already in-flight."
160160
);
161161
}
162162
} else {
163-
log_info!(?crash_report, "no crash reporter available for crash");
163+
log_info!(crash_report:?; "no crash reporter available for crash");
164164
}
165165
}
166166

src/starnix/kernel/execution/executor.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -601,7 +601,7 @@ where
601601
// Now that the task has a thread handle, update the thread's role using the policy configured.
602602
drop(task_thread_guard);
603603
if let Err(err) = ref_task.sync_scheduler_policy_to_role() {
604-
log_warn!(?err, "Couldn't update freshly spawned thread's profile.");
604+
log_warn!(err:?; "Couldn't update freshly spawned thread's profile.");
605605
}
606606

607607
Ok(())

0 commit comments

Comments
 (0)