mirror of
https://github.com/topjohnwu/Magisk.git
synced 2025-06-12 21:27:41 +02:00
Standardize logging and error handling
- Introduce new types: LoggedResult and LoggedError - Introduce new extension methods to log and add additional msgs - Never exit when logging error messages in Rust (all errors should be handled by using Result and Rust's error propagation) - Remove all usages of anyhow as it doesn't fit Magisk's use cases
This commit is contained in:
@ -20,6 +20,7 @@ mod xwrap;
|
||||
pub mod ffi {
|
||||
#[derive(Copy, Clone)]
|
||||
pub enum LogLevel {
|
||||
ErrorCxx,
|
||||
Error,
|
||||
Warn,
|
||||
Info,
|
||||
@ -32,6 +33,7 @@ pub mod ffi {
|
||||
}
|
||||
|
||||
extern "Rust" {
|
||||
#[rust_name = "log_from_cxx"]
|
||||
fn log_with_rs(level: LogLevel, msg: &[u8]);
|
||||
fn exit_on_error(b: bool);
|
||||
fn set_log_level_state(level: LogLevel, enabled: bool);
|
||||
|
Reference in New Issue
Block a user