defmt_json_schema/
lib.rs

1use log::Level;
2use serde::{Deserialize, Serialize};
3
4#[derive(Clone, Debug, Deserialize, Serialize, PartialEq, Eq, PartialOrd, Ord)]
5pub struct SchemaVersion {
6    pub schema_version: u32,
7}
8
9pub mod v1 {
10    use super::*;
11
12    pub const SCHEMA_VERSION: SchemaVersion = SchemaVersion { schema_version: 1 };
13
14    #[derive(Clone, Debug, Deserialize, Serialize)]
15    pub struct JsonFrame {
16        pub data: String,
17        /// Unix timestamp in nanoseconds
18        pub host_timestamp: i64,
19        pub level: Option<Level>,
20        pub location: Location,
21        pub target_timestamp: String,
22    }
23
24    #[derive(Clone, Debug, Deserialize, Serialize)]
25    pub struct Location {
26        pub file: Option<String>,
27        pub line: Option<u32>,
28        pub module_path: Option<ModulePath>,
29    }
30
31    #[derive(Clone, Debug, Deserialize, Serialize)]
32    pub struct ModulePath {
33        pub crate_name: String,
34        pub modules: Vec<String>,
35        pub function: String,
36    }
37}