fix: us OSLog framework for logging on iOS (#120)
* fix: us OSLog framework for logging on iOS * cleanup
This commit is contained in:
+2
-2
@@ -62,8 +62,8 @@ log-panics = { version = "2", features = ["with-backtrace"] }
|
||||
[target.'cfg(target_os = "ios")'.dependencies]
|
||||
# Send panics to syslog (instead of stderr).
|
||||
log-panics = { version = "2", features = ["with-backtrace"] }
|
||||
# Use stderr for logging on iOS.
|
||||
simple-logging = "2.0.2"
|
||||
# Support for logging on iOS (https://developer.apple.com/documentation/oslog)
|
||||
oslog = "0.2.0"
|
||||
|
||||
[dev-dependencies]
|
||||
mockall = "0.11.4"
|
||||
|
||||
@@ -13,10 +13,13 @@ pub fn init_logging() {
|
||||
|
||||
#[cfg(target_os = "ios")]
|
||||
pub fn init_logging() {
|
||||
// I could not figure out how to get fancier logging set up on iOS
|
||||
// but logging to stderr seems to work.
|
||||
simple_logging::log_to(std::io::stderr(), log::LevelFilter::Info);
|
||||
debug!("Logging initialized");
|
||||
let init_result = oslog::OsLogger::new("dev.shorebird")
|
||||
.level_filter(log::LevelFilter::Info)
|
||||
.init();
|
||||
match init_result {
|
||||
Ok(_) => debug!("Logging initialized"),
|
||||
Err(e) => error!("Failed to initialize logging: {}", e),
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(all(not(target_os = "android"), not(target_os = "ios")))]
|
||||
|
||||
Reference in New Issue
Block a user