Implement ser/de for OsTraceRelay outputs

This commit is contained in:
Jackson Coxson
2025-08-23 09:01:58 -06:00
parent 11c53dac86
commit 104b5c1543
3 changed files with 8 additions and 4 deletions

1
Cargo.lock generated
View File

@@ -369,6 +369,7 @@ dependencies = [
"iana-time-zone",
"js-sys",
"num-traits",
"serde",
"wasm-bindgen",
"windows-link",
]

View File

@@ -30,7 +30,9 @@ base64 = { version = "0.22" }
indexmap = { version = "2.7", features = ["serde"], optional = true }
uuid = { version = "1.12", features = ["serde", "v4"], optional = true }
chrono = { version = "0.4.40", optional = true, default-features = false }
chrono = { version = "0.4.40", optional = true, default-features = false, features = [
"serde",
] }
serde_json = { version = "1", optional = true }
json = { version = "0.12", optional = true }

View File

@@ -4,6 +4,7 @@
//! https://github.com/doronz88/pymobiledevice3/blob/master/pymobiledevice3/services/os_trace.py
use chrono::{DateTime, NaiveDateTime};
use serde::{Deserialize, Serialize};
use tokio::io::AsyncWriteExt;
use crate::{Idevice, IdeviceError, IdeviceService, obf};
@@ -30,7 +31,7 @@ pub struct OsTraceRelayReceiver {
inner: OsTraceRelayClient,
}
#[derive(Debug, Clone, PartialEq, Eq)]
#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
pub struct OsTraceLog {
pub pid: u32,
pub timestamp: NaiveDateTime,
@@ -41,13 +42,13 @@ pub struct OsTraceLog {
pub label: Option<SyslogLabel>,
}
#[derive(Debug, Clone, PartialEq, Eq)]
#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
pub struct SyslogLabel {
pub subsystem: String,
pub category: String,
}
#[derive(Debug, Clone, PartialEq, Eq)]
#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
pub enum LogLevel {
Notice = 0,
Info = 1,