Skip to content

Commit 8883f8a

Browse files
committed
feat: introduced TraceEventsFileFormat
1 parent 0165ecc commit 8883f8a

File tree

1 file changed

+13
-4
lines changed

1 file changed

+13
-4
lines changed

runtime_tracing/src/tracer.rs

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,11 @@ pub struct Tracer {
3434
types: HashMap<String, TypeId>,
3535
}
3636

37+
pub enum TraceEventsFileFormat {
38+
Json,
39+
Binary
40+
}
41+
3742
// we ensure in start they are registered with those id-s
3843

3944
// pub const EXAMPLE_INT_TYPE_ID: TypeId = TypeId(0);
@@ -294,10 +299,14 @@ impl Tracer {
294299
Ok(())
295300
}
296301

297-
pub fn store_trace_events(&self, path: &Path) -> Result<(), Box<dyn Error>> {
298-
// TODO: probably change format
299-
let json = serde_json::to_string(&self.events)?;
300-
fs::write(path, json)?;
302+
pub fn store_trace_events(&self, path: &Path, format: TraceEventsFileFormat) -> Result<(), Box<dyn Error>> {
303+
match format {
304+
TraceEventsFileFormat::Json => {
305+
let json = serde_json::to_string(&self.events)?;
306+
fs::write(path, json)?;
307+
}
308+
TraceEventsFileFormat::Binary => todo!(),
309+
}
301310
Ok(())
302311
}
303312

0 commit comments

Comments
 (0)