Skip to content

Commit 91e5743

Browse files
committed
print file content
1 parent aad5b02 commit 91e5743

File tree

1 file changed

+8
-3
lines changed

1 file changed

+8
-3
lines changed

opentelemetry-otlp/tests/integration_test/src/logs_asserter.rs

+8-3
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
use anyhow::Result;
22
use opentelemetry_proto::tonic::logs::v1::{LogRecord, LogsData, ResourceLogs};
3-
use std::fs::File;
3+
use tracing::info;
4+
use std::{fs::File, io::Read};
45

56
// Given two ResourceLogs, assert that they are equal except for the timestamps
67
pub struct LogsAsserter {
@@ -98,8 +99,12 @@ impl std::fmt::Debug for LogRecordWrapper {
9899

99100
// read a file contains ResourceSpans in json format
100101
pub fn read_logs_from_json(file: File) -> Result<Vec<ResourceLogs>> {
101-
let reader = std::io::BufReader::new(file);
102+
// print file contents
103+
let mut contents = String::new();
104+
let mut reader = std::io::BufReader::new(&file);
105+
reader.read_to_string(&mut contents)?;
106+
info!(file_contents=contents);
102107

103-
let log_data: LogsData = serde_json::from_reader(reader)?;
108+
let log_data: LogsData = serde_json::from_str(&contents)?;
104109
Ok(log_data.resource_logs)
105110
}

0 commit comments

Comments
 (0)