pyunilogs 0.1.0__tar.gz → 0.2.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {pyunilogs-0.1.0 → pyunilogs-0.2.0}/Cargo.lock +1 -1
- {pyunilogs-0.1.0 → pyunilogs-0.2.0}/Cargo.toml +1 -1
- {pyunilogs-0.1.0 → pyunilogs-0.2.0}/PKG-INFO +1 -1
- {pyunilogs-0.1.0 → pyunilogs-0.2.0}/src/lib.rs +19 -6
- {pyunilogs-0.1.0 → pyunilogs-0.2.0}/.github/workflows/CI.yml +0 -0
- {pyunilogs-0.1.0 → pyunilogs-0.2.0}/.gitignore +0 -0
- {pyunilogs-0.1.0 → pyunilogs-0.2.0}/README.md +0 -0
- {pyunilogs-0.1.0 → pyunilogs-0.2.0}/pyproject.toml +0 -0
- {pyunilogs-0.1.0 → pyunilogs-0.2.0}/src/example.rs +0 -0
|
@@ -1,4 +1,7 @@
|
|
|
1
|
+
use std::panic;
|
|
2
|
+
|
|
1
3
|
use macos_unifiedlogs::unified_log;
|
|
4
|
+
use pyo3::exceptions::PyRuntimeError;
|
|
2
5
|
use pyo3::prelude::*;
|
|
3
6
|
|
|
4
7
|
mod example;
|
|
@@ -52,15 +55,25 @@ impl LogData {
|
|
|
52
55
|
|
|
53
56
|
#[pyfunction]
|
|
54
57
|
fn extract_logarchive(input_path: String) -> PyResult<Vec<LogData>> {
|
|
55
|
-
let
|
|
58
|
+
let final_result = panic::catch_unwind(|| {
|
|
59
|
+
let mut results = example::parse_log_archive(&input_path);
|
|
56
60
|
|
|
57
|
-
|
|
61
|
+
let mut list = Vec::new();
|
|
58
62
|
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
63
|
+
for entry in results.drain(..) {
|
|
64
|
+
list.push(LogData::from_logdata(&entry))
|
|
65
|
+
}
|
|
66
|
+
return list;
|
|
67
|
+
});
|
|
62
68
|
|
|
63
|
-
|
|
69
|
+
if final_result.is_err() {
|
|
70
|
+
// quick and dirty catch the panics
|
|
71
|
+
return Err(PyRuntimeError::new_err(
|
|
72
|
+
"Error extracting logs with pyunilogs",
|
|
73
|
+
));
|
|
74
|
+
} else {
|
|
75
|
+
return Ok(final_result.unwrap());
|
|
76
|
+
}
|
|
64
77
|
}
|
|
65
78
|
|
|
66
79
|
/// A Python module implemented in Rust.
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|