Skip to content

Commit

Permalink
build(dep): ios target dep (#658)
Browse files Browse the repository at this point in the history
  • Loading branch information
ibigbug authored Dec 1, 2024
1 parent 4dab14e commit 866f844
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 6 deletions.
4 changes: 3 additions & 1 deletion clash_lib/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,6 @@ ring-compat = { version = "0.8", features = ["aead"] }
rand = "0.8"
tracing = "0.1"
tracing-subscriber = { version = "0.3", features = ["env-filter"] }
tracing-oslog = { branch = "main", git = "https://github.com/Absolucy/tracing-oslog.git" }
tracing-appender = "0.2"

shadowsocks = { version="1.21", optional = true, features=["aead-cipher-2022","stream-cipher"] }
Expand Down Expand Up @@ -157,6 +156,9 @@ unix-udp-sock = { git = "https://github.com/Watfaq/unix-udp-sock.git", rev = "cd
[target.'cfg(macos)'.dependencies]
security-framework = "3.0.1"

[target.'cfg(target_os="ios")'.dependencies]
tracing-oslog = { branch = "main", git = "https://github.com/Absolucy/tracing-oslog.git" }

[target.'cfg(windows)'.dependencies]
windows = { version = "0.58", features = [
"Win32_Networking_WinSock",
Expand Down
11 changes: 6 additions & 5 deletions clash_lib/src/app/logging.rs
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ use tokio::sync::broadcast::Sender;

use tracing::debug;
use tracing_appender::non_blocking::WorkerGuard;
#[cfg(target_os = "ios")]
use tracing_oslog::OsLogger;
use tracing_subscriber::{
filter::{self, filter_fn, Directive},
Expand Down Expand Up @@ -125,11 +126,11 @@ pub fn setup_logging(
None
};

let ios_os_log = if cfg!(target_os = "ios") {
Some(OsLogger::new("com.watfaq.clash", "default"))
} else {
None
};
#[cfg(target_os = "ios")]
let ios_os_log = Some(OsLogger::new("com.watfaq.clash", "default"));
#[cfg(not(target_os = "ios"))]
let ios_os_log =
tracing_subscriber::fmt::Layer::new().with_writer(std::io::empty);

let (appender, g) = if let Some(log_file) = log_file {
let file_appender = tracing_appender::rolling::daily(cwd, log_file);
Expand Down

0 comments on commit 866f844

Please sign in to comment.