Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

build(dep): ios target dep #658

Merged
merged 4 commits into from
Dec 1, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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