Skip to content

Commit 42e66ce

Browse files
committed
fix inconsistent logging crate names
Signed-off-by: Simon Davies <[email protected]>
1 parent 8feb67b commit 42e66ce

File tree

5 files changed

+13
-13
lines changed

5 files changed

+13
-13
lines changed

docs/hyperlight-metrics-logs-and-traces.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -66,13 +66,13 @@ In the [examples/tracing](../src/hyperlight_host/examples/tracing) directory, th
6666
#### Linux
6767

6868
```bash
69-
RUST_LOG='none,hyperlight-host=info,tracing=info' cargo run --example tracing
69+
RUST_LOG='none,hyperlight_host=info,tracing=info' cargo run --example tracing
7070
```
7171

7272
#### Windows
7373

7474
```powershell
75-
$env:RUST_LOG='none,hyperlight-host=info,tracing=info'; cargo run --example tracing
75+
$env:RUST_LOG='none,hyperlight_host=info,tracing=info'; cargo run --example tracing
7676
```
7777

7878
### Using OTLP exporter and Jaeger

src/hyperlight_host/src/sandbox/outb.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@ pub(super) fn outb_log(mgr: &mut SandboxMemoryManager<HostSharedMemory>) -> Resu
8888
&Record::builder()
8989
.args(format_args!("{}", log_data.message))
9090
.level(record_level)
91-
.target("hyperlight-guest")
91+
.target("hyperlight_guest")
9292
.file(source_file)
9393
.line(line)
9494
.module_path(source)
@@ -100,7 +100,7 @@ pub(super) fn outb_log(mgr: &mut SandboxMemoryManager<HostSharedMemory>) -> Resu
100100
&Record::builder()
101101
.args(format_args!("{}", log_data.message))
102102
.level(record_level)
103-
.target("hyperlight-guest")
103+
.target("hyperlight_guest")
104104
.file(Some(&log_data.source_file))
105105
.line(Some(log_data.line))
106106
.module_path(Some(&log_data.source))
@@ -442,7 +442,7 @@ mod tests {
442442
test_value_as_str(metadata_values_map, "level", expected_level);
443443
test_value_as_str(event_values_map, "log.file", "test source file");
444444
test_value_as_str(event_values_map, "log.module_path", "test source");
445-
test_value_as_str(event_values_map, "log.target", "hyperlight-guest");
445+
test_value_as_str(event_values_map, "log.target", "hyperlight_guest");
446446
count_matching_events += 1;
447447
}
448448
assert!(

src/hyperlight_host/tests/integration_test.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -485,8 +485,8 @@ fn log_message() {
485485
log_test_messages();
486486
assert_eq!(5 + num_fixed_trace_log, LOGGER.num_log_calls());
487487
// The number of enabled calls is the number of times that the enabled function is called
488-
// with a target of "hyperlight-guest"
489-
// This should be the same as the number of log calls as all the log calls for the "hyperlight-guest" target should be filtered in
488+
// with a target of "hyperlight_guest"
489+
// This should be the same as the number of log calls as all the log calls for the "hyperlight_guest" target should be filtered in
490490
// the guest
491491
assert_eq!(LOGGER.num_log_calls(), LOGGER.num_enabled_calls());
492492

src/hyperlight_testing/src/logger.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,7 @@ impl Log for Logger {
9090
}
9191

9292
LOGCALLS.with(|log_calls| {
93-
if record.target().contains("hyperlight-guest") {
93+
if record.target().contains("hyperlight_guest") {
9494
println!("Thread {:?} {:?}", current().id(), record);
9595
println!("Thread {:?} {:?}", current().id(), record.metadata());
9696
}

src/hyperlight_testing/src/simplelogger.rs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ limitations under the License.
1515
*/
1616

1717
// this is a non threadsafe logger for testing purposes, to test the log messages emitted by the guest.
18-
// it will only log messages from the hyperlight-guest target. It will not log messages from other targets.
18+
// it will only log messages from the hyperlight_guest target. It will not log messages from other targets.
1919
// this target is only used when handling an outb log request from the guest, so this logger will only capture those messages.
2020

2121
use std::sync::Once;
@@ -80,13 +80,13 @@ impl Log for SimpleLogger {
8080
fn enabled(&self, metadata: &Metadata) -> bool {
8181
// This allows us to count the actual number of messages that have been logged by the guest
8282
// because the guest derives its log level from the host log level then the number times that enabled is called for
83-
// the "hyperlight-guest" target will be the same as the number of messages logged by the guest.
84-
// In other words this function should always return true for the "hyperlight-guest" target.
83+
// the "hyperlight_guest" target will be the same as the number of messages logged by the guest.
84+
// In other words this function should always return true for the "hyperlight_guest" target.
8585
unsafe {
86-
if metadata.target() == "hyperlight-guest" {
86+
if metadata.target() == "hyperlight_guest" {
8787
NUMBER_OF_ENABLED_CALLS += 1;
8888
}
89-
metadata.target() == "hyperlight-guest" && metadata.level() <= log::max_level()
89+
metadata.target() == "hyperlight_guest" && metadata.level() <= log::max_level()
9090
}
9191
}
9292
fn log(&self, record: &Record) {

0 commit comments

Comments
 (0)