From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from atuin.qyliss.net (localhost [IPv6:::1]) by atuin.qyliss.net (Postfix) with ESMTP id F2BA998C1; Thu, 26 Feb 2026 15:07:56 +0000 (UTC) Received: by atuin.qyliss.net (Postfix, from userid 993) id A2B7A9920; Thu, 26 Feb 2026 15:07:53 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 4.0.1 (2024-03-26) on atuin.qyliss.net X-Spam-Level: * X-Spam-Status: No, score=1.4 required=3.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,DMARC_MISSING,MANY_SUBDOM,RCVD_IN_DNSWL_LOW, SPF_HELO_PASS autolearn=no autolearn_force=no version=4.0.1 Received: from fhigh-a5-smtp.messagingengine.com (fhigh-a5-smtp.messagingengine.com [103.168.172.156]) by atuin.qyliss.net (Postfix) with ESMTPS id BE801991D for ; Thu, 26 Feb 2026 15:07:51 +0000 (UTC) Received: from phl-compute-05.internal (phl-compute-05.internal [10.202.2.45]) by mailfhigh.phl.internal (Postfix) with ESMTP id 1234D14000A9 for ; Thu, 26 Feb 2026 10:07:50 -0500 (EST) Received: from phl-frontend-04 ([10.202.2.163]) by phl-compute-05.internal (MEProxy); Thu, 26 Feb 2026 10:07:50 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=alyssa.is; h=cc :content-transfer-encoding:content-type:date:date:from:from :in-reply-to:in-reply-to:message-id:mime-version:references :reply-to:subject:subject:to:to; s=fm2; t=1772118470; x= 1772204870; bh=xMGdbvu7KVSA5gTDAwiddGAa3RDVTLXn58Q5sg7sfs0=; b=f 5dz5DpLcHrrJNZqPSp4CZBWK/un+fx+CmY+MXW4QkV2BsoE8yFEOpnD8pYg4cPjL Sn/zaXR2ExEvKHcWDJ9b5vXwSQnJukQHF806G+FLdWAqt9SqJvDqSxtJm+usMG7X o9dVUZcDy5+Yq7nTB/v/34r5o3jXil8zRa6XZYRBLOOEexgRhyG/kCc8g1qNZ60q m4Tj9jyAvePw0o2TUnUUKGlqDrHq7uCQ5wwazMFK+z4z31FHJy2Tas4f1lzt5eax tp0JOVt5k1Vdu3w5urgjuLvbGrYdgwHrGWtX0ExCs3e/ebEm1n4P6mRXiFipxFOB H6Vop2i8F0ZGNDSb6HveA== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:content-transfer-encoding:content-type :date:date:feedback-id:feedback-id:from:from:in-reply-to :in-reply-to:message-id:mime-version:references:reply-to:subject :subject:to:to:x-me-proxy:x-me-sender:x-me-sender:x-sasl-enc; s= fm3; t=1772118470; x=1772204870; bh=xMGdbvu7KVSA5gTDAwiddGAa3RDV TLXn58Q5sg7sfs0=; b=FTfKTU0nqBbdEj0qlD90aKx3GHoLiKaRwkGWulZSMfBQ 5FHWBZUviTFCqVIDOENqEE10aN46lmwLE0PI5NWRIEB0Ey/FLcdbtGAX8qc38PlV nh93zAInbEHUfy1k/y9JWH++etE6Y+qGpQBT9wdFF/qq21evJ20qmCnnWvDI460f +/4UTCx2TPq9dkU0DsqbsUzUm9H3/fh5UMonkysSxC9NtlvSh3rSFUuYCqatd+ZA p9xyreWEU9ovACgP4ma2QmRgsJ4+AwQgTtRnLITiBFWYBuCi2RRbwbRw4ze5J4M4 Rnkfe3hDyKUqyN1s6kAstmCKOkYg+wco/wZECwkvPg== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeefgedrtddtgddvgeeifeeiucetufdoteggodetrf dotffvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfurfetoffkrfgpnffqhgenuceu rghilhhouhhtmecufedttdenucenucfjughrpefhvffufffkofgjfhgggfestdekredtre dttdenucfhrhhomheptehlhihsshgrucftohhsshcuoehhihesrghlhihsshgrrdhisheq necuggftrfgrthhtvghrnhepkedvtddvueffueejudfhueetgeeiudffjeelhfeukeefvd ehueetffelkeekfeejnecuffhomhgrihhnpehsphgvtghtrhhumhdrhhhoshhtnecuvehl uhhsthgvrhfuihiivgeptdenucfrrghrrghmpehmrghilhhfrhhomhephhhisegrlhihsh hsrgdrihhspdhnsggprhgtphhtthhopedupdhmohguvgepshhmthhpohhuthdprhgtphht thhopeguvghvvghlsehsphgvtghtrhhumhdqohhsrdhorhhg X-ME-Proxy: Feedback-ID: i12284293:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA for ; Thu, 26 Feb 2026 10:07:49 -0500 (EST) Received: by mbp.qyliss.net (Postfix, from userid 1000) id 048F975C4EA8; Thu, 26 Feb 2026 16:07:46 +0100 (CET) From: Alyssa Ross To: devel@spectrum-os.org Subject: [PATCH 2/2] tools/xdg-desktop-portal-spectrum-host: use tracing Date: Thu, 26 Feb 2026 16:07:32 +0100 Message-ID: <20260226150732.150645-2-hi@alyssa.is> X-Mailer: git-send-email 2.52.0 In-Reply-To: <20260226150732.150645-1-hi@alyssa.is> References: <20260226150732.150645-1-hi@alyssa.is> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Message-ID-Hash: SBJYQ7VVJBGAUJK4JZCWKQ6N4CBOZBBF X-Message-ID-Hash: SBJYQ7VVJBGAUJK4JZCWKQ6N4CBOZBBF X-MailFrom: hi@alyssa.is X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; emergency; loop; banned-address; member-moderation; header-match-devel.spectrum-os.org-0; header-match-devel.spectrum-os.org-1; header-match-devel.spectrum-os.org-2; header-match-devel.spectrum-os.org-3; header-match-devel.spectrum-os.org-4; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; digests; suspicious-header X-Mailman-Version: 3.3.9 Precedence: list List-Id: Patches and low-level development discussion Archived-At: <> List-Archive: <> List-Help: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: Given we need this anyway for zbus, might as well use it. Signed-off-by: Alyssa Ross --- .../src/file_chooser.rs | 6 ++--- .../src/main.rs | 22 ++++++------------- 2 files changed, 10 insertions(+), 18 deletions(-) diff --git a/tools/xdg-desktop-portal-spectrum-host/src/file_chooser.rs b/tools/xdg-desktop-portal-spectrum-host/src/file_chooser.rs index 4eae5b9..17532db 100644 --- a/tools/xdg-desktop-portal-spectrum-host/src/file_chooser.rs +++ b/tools/xdg-desktop-portal-spectrum-host/src/file_chooser.rs @@ -8,12 +8,12 @@ use std::path::PathBuf; use std::sync::OnceLock; use percent_encoding::percent_decode; +use tracing::error; use url::Url; use zbus::zvariant::{Array, ObjectPath, OwnedValue, Value}; use zbus::{Connection, interface}; use crate::documents::share_file; -use crate::msg; const XDG_DESKTOP_PORTAL_RESPONSE_SUCCESS: u32 = 0; const XDG_DESKTOP_PORTAL_RESPONSE_CANCELLED: u32 = 1; @@ -50,7 +50,7 @@ impl FileChooser { Ok(Some(results)) => Ok((XDG_DESKTOP_PORTAL_RESPONSE_SUCCESS, results)), Ok(None) => Ok((XDG_DESKTOP_PORTAL_RESPONSE_CANCELLED, BTreeMap::new())), Err(e) => { - msg(&e); + error!("{e}"); Ok((XDG_DESKTOP_PORTAL_RESPONSE_OTHER, BTreeMap::new())) } } @@ -71,7 +71,7 @@ impl FileChooser { Ok(Some(results)) => Ok((XDG_DESKTOP_PORTAL_RESPONSE_SUCCESS, results)), Ok(None) => Ok((XDG_DESKTOP_PORTAL_RESPONSE_CANCELLED, BTreeMap::new())), Err(e) => { - msg(&e); + error!("{e}"); Ok((XDG_DESKTOP_PORTAL_RESPONSE_OTHER, BTreeMap::new())) } } diff --git a/tools/xdg-desktop-portal-spectrum-host/src/main.rs b/tools/xdg-desktop-portal-spectrum-host/src/main.rs index 40b14b4..f714aad 100644 --- a/tools/xdg-desktop-portal-spectrum-host/src/main.rs +++ b/tools/xdg-desktop-portal-spectrum-host/src/main.rs @@ -23,6 +23,7 @@ use landlock::{ ABI, Access, AccessFs, AccessNet, CompatLevel, Compatible, Ruleset, RulesetAttr, RulesetError, Scope, }; +use tracing::{error, info}; use tracing_subscriber::EnvFilter; use zbus::{AuthMechanism, Connection, MessageStream, connection}; @@ -158,7 +159,7 @@ async fn run_guest_connection(mut conn: Async) -> Result<(), String> { let e = format!("sending setup response to guest: {e}"); if guest_dbus_conn_result.is_err() { - msg(&e); + error!("{e}"); } else { return Err(e); } @@ -167,7 +168,7 @@ async fn run_guest_connection(mut conn: Async) -> Result<(), String> drop(conn); let guest_dbus_conn = guest_dbus_conn_result?; - msg("Created org.freedesktop.impl.portal.desktop.spectrum.host on guest bus"); + info!("Created org.freedesktop.impl.portal.desktop.spectrum.host on guest bus"); let mut guest_messages = MessageStream::from(guest_dbus_conn); loop { @@ -229,7 +230,7 @@ fn read_argv() { args.next(); if args.next().is_some() { - msg("too many arguments"); + error!("too many arguments"); exit(1); } } @@ -258,7 +259,7 @@ fn run() -> Result<(), String> { let (conn, _) = match stdin.accept().await { Ok(conn) => conn, Err(e) => { - msg(&format!("accepting connection from guest: {e}")); + error!("accepting connection from guest: {e}"); continue; } }; @@ -275,7 +276,7 @@ fn run() -> Result<(), String> { EXECUTOR .spawn(async move { if let Err(e) = run_guest_connection(conn).await { - msg(&format!("guest connection error: {e}")); + error!("guest connection error: {e}"); } }) .detach(); @@ -283,18 +284,9 @@ fn run() -> Result<(), String> { })) } -fn msg(e: &str) { - if let Some(prog) = args_os().next() - && let Some(prog) = PathBuf::from(prog).file_name() - { - eprint!("{}: ", prog.to_string_lossy()); - } - eprintln!("{e}"); -} - fn main() { if let Err(e) = run() { - msg(&e); + error!("{e}"); exit(1); } } -- 2.52.0