From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp2.migadu.com ([2001:41d0:403:4876::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms8.migadu.com with LMTPS id aJgOHo6yz2UT4gAAe85BDQ:P1 (envelope-from ) for ; Fri, 16 Feb 2024 20:07:58 +0100 Received: from aspmx1.migadu.com ([2001:41d0:403:4876::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp2.migadu.com with LMTPS id aJgOHo6yz2UT4gAAe85BDQ (envelope-from ) for ; Fri, 16 Feb 2024 20:07:58 +0100 X-Envelope-To: larch@yhetil.org Authentication-Results: aspmx1.migadu.com; dkim=fail ("headers rsa verify failed") header.d=gmail.com header.s=20230601 header.b=eMHbzIR1; spf=pass (aspmx1.migadu.com: domain of "guix-patches-bounces+larch=yhetil.org@gnu.org" designates 209.51.188.17 as permitted sender) smtp.mailfrom="guix-patches-bounces+larch=yhetil.org@gnu.org"; dmarc=fail reason="SPF not aligned (relaxed)" header.from=gmail.com (policy=none) ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=yhetil.org; s=key1; t=1708110365; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding:resent-cc: resent-from:resent-sender:resent-message-id:in-reply-to:in-reply-to: references:references:list-id:list-help:list-unsubscribe: list-subscribe:list-post:dkim-signature; bh=mhH//tyO9r5A47AeqgO4ilM3l83zmKcwZF8w2pqwyJM=; b=eYGqKtErmvH7qApANMb8yq/kfD+Yp0v17Ghuxjo2ND/A4Z2KAVFO54H0SxQlACYkJB5WVQ u2sw5Vnx1Bn0rRk+sy1QQaHGKYFI03o0TYLhRmzmNRvnj+jdyqgrPDtidRPnByGkGdPPDY UwYNkq6l/tb3B4Vr7uFpTChBWZlsP8XLRCOm4MaQTthSP7GDpfoIeWea3bj1nzPFFg0e13 TbRjnQsJ8N1mCjpBUUQr0vlSo7zKbBiJm5IT4FGybOhqgcozCR9YQoD/43fmIFSSDiLSAd pQqsPPUpRzmedy6j2BYKqEUMvyzfLzCdEuBf5+1NEazUo2tsynzvwRaJp5vqrA== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=fail ("headers rsa verify failed") header.d=gmail.com header.s=20230601 header.b=eMHbzIR1; spf=pass (aspmx1.migadu.com: domain of "guix-patches-bounces+larch=yhetil.org@gnu.org" designates 209.51.188.17 as permitted sender) smtp.mailfrom="guix-patches-bounces+larch=yhetil.org@gnu.org"; dmarc=fail reason="SPF not aligned (relaxed)" header.from=gmail.com (policy=none) ARC-Seal: i=1; s=key1; d=yhetil.org; t=1708110365; a=rsa-sha256; cv=none; b=ahlkfEUqw5SdnQjAdC3FCwTg9xq31oRLIMUkPLu6uIX6EVdThwNZ9/4ACchoRkm9sMVC3k 3lFo1aAbTtWocO+4zkg1qkf+HVas/8m0T2NnpDDAPlpniqwOMkeyzfNxXX3Yqkq8zgpY1a ERyaipNCnEbrFL0+7APUNVGlrTCcifEgBAU5MHPu5aPB+xWcoWxwpaW15ev8hoAPrPGhKz pY4JLX8xiP3gKXquoAPoiVcbuaQotlywADBiAUnriYWptBE0n6f/GgN1WP++fJyFYaWXex Rusv12E5eW9fb6LBsewTMfcIBhQBu3Du00vydBuRsowZleyeJIC4APzl3m/klg== Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by aspmx1.migadu.com (Postfix) with ESMTPS id DC255684D3 for ; Fri, 16 Feb 2024 20:06:04 +0100 (CET) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rb3Wq-000359-3c; Fri, 16 Feb 2024 14:05:44 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1rb3Wo-00034z-RC for guix-patches@gnu.org; Fri, 16 Feb 2024 14:05:42 -0500 Received: from debbugs.gnu.org ([2001:470:142:5::43]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1rb3Wo-0007aY-J1 for guix-patches@gnu.org; Fri, 16 Feb 2024 14:05:42 -0500 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1rb3X7-0004TZ-Oo for guix-patches@gnu.org; Fri, 16 Feb 2024 14:06:01 -0500 X-Loop: help-debbugs@gnu.org Subject: [bug#68946] [PATCH v2] guix: Add logging module. Resent-From: Maxim Cournoyer Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Fri, 16 Feb 2024 19:06:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 68946 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: Simon Tournier Cc: 68946@debbugs.gnu.org, Mathieu Othacehe , Ludovic =?UTF-8?Q?Court=C3=A8s?= , Tobias Geerinckx-Rice , Josselin Poiret , Ricardo Wurmus , Christopher Baines Received: via spool by 68946-submit@debbugs.gnu.org id=B68946.170811030317136 (code B ref 68946); Fri, 16 Feb 2024 19:06:01 +0000 Received: (at 68946) by debbugs.gnu.org; 16 Feb 2024 19:05:03 +0000 Received: from localhost ([127.0.0.1]:60206 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1rb3WB-0004SJ-0w for submit@debbugs.gnu.org; Fri, 16 Feb 2024 14:05:03 -0500 Received: from mail-qv1-f43.google.com ([209.85.219.43]:57658) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1rb3W7-0004Rl-GQ for 68946@debbugs.gnu.org; Fri, 16 Feb 2024 14:05:00 -0500 Received: by mail-qv1-f43.google.com with SMTP id 6a1803df08f44-68f3dc95d3bso2873926d6.3 for <68946@debbugs.gnu.org>; Fri, 16 Feb 2024 11:04:39 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1708110214; x=1708715014; darn=debbugs.gnu.org; h=content-transfer-encoding:mime-version:user-agent:message-id:date :references:in-reply-to:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=mhH//tyO9r5A47AeqgO4ilM3l83zmKcwZF8w2pqwyJM=; b=eMHbzIR1RDWibMT5NOs35ipNkPAvkkx055AusZPpfRjI3owF1GS5b/bVLfYyxiv1bH 4hBwVw31TyhFK6g42RKBKHvxknfrIxtk/I1CUPhEmpIjqlEKJcMqXmc6XcMPcsQ2uUCF AwTN7DygiMZ8Sgq5r7WbRd3miL71lz/oBsgDLHgOiR59UrKz2nN4r+BvM/zVg0PsqERK vXqbHqwyrDLrSLyNf8+7N7Kg24t9OjLIWjo8ZdHvd6jE76YoKDrUaGpMlpOaNKgvVdAi wiuWBJMuHZca9LKTZv+dGIUNIHTdZ1+oHaawN3OWk+z3q59ksR+CQwNBvlhBUDyRALZV PhtA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1708110214; x=1708715014; h=content-transfer-encoding:mime-version:user-agent:message-id:date :references:in-reply-to:subject:cc:to:from:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to; bh=mhH//tyO9r5A47AeqgO4ilM3l83zmKcwZF8w2pqwyJM=; b=FWe6spSZAdugJ9DjbCkfwkFo0WPK529LIGGT9G9odvUTEkT/GVVrAA0MgJ1Iu82Qwx Kfjv4gbWaneFLm72tfmrEIEI0PDGEYsbBtFVc4+uKQpPmgk4WA+AHDJoPnP8jDgA3caS +lZf6fPXYl7R1RKVg08VMFYZqEHOqQ0/lCk8/KKrA67/glwY414XpyT/iZovHMFdJcKP 9dDBr2ueZdTeEwS7sAMmQQa4mP9ltErh4Vy0F4iPn+UTh1weyG/zfrGLVAqgto5ZOQRy MiKlU//F0JEwgcNtJgtZSzDnwIBUVkHgPmYuPiweBmZCiXpBDR9HSjZ/sSDWtjzQKeMG 7ooA== X-Gm-Message-State: AOJu0YzNTsm0+Oo3oaR8gannDcQ8zWGLiD73ILTPSBSMfOR2vZ3D+Q8k 6SRBSsBTtS1KiWZKIwpEQg2vWwigjaS4VgsyYe4mu1mvF2Sc8Kfe X-Google-Smtp-Source: AGHT+IHvpM5Gm3pHBJ7iv+id20T36ekB/nyqZSkf2DWxg1TW26dHNIXsvrlEEiQESHtsCSeRs6FxWg== X-Received: by 2002:a05:6214:21ec:b0:68f:160c:fd8a with SMTP id p12-20020a05621421ec00b0068f160cfd8amr6002679qvj.0.1708110214345; Fri, 16 Feb 2024 11:03:34 -0800 (PST) Received: from hurd (dsl-148-13.b2b2c.ca. [66.158.148.13]) by smtp.gmail.com with ESMTPSA id cr5-20020ad456e5000000b0068f0307160bsm182938qvb.63.2024.02.16.11.03.33 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 16 Feb 2024 11:03:33 -0800 (PST) From: Maxim Cournoyer In-Reply-To: <87frxvm7ai.fsf@gmail.com> (Simon Tournier's message of "Wed, 14 Feb 2024 15:47:49 +0100") References: <0b81168e693a21f7fb08bd7677a5cc3120418fc9.1707626620.git.maxim.cournoyer@gmail.com> <87frxvm7ai.fsf@gmail.com> Date: Fri, 16 Feb 2024 14:03:32 -0500 Message-ID: <87le7ktenv.fsf@gmail.com> User-Agent: Gnus/5.13 (Gnus v5.13) MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: guix-patches@gnu.org List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: guix-patches-bounces+larch=yhetil.org@gnu.org Sender: guix-patches-bounces+larch=yhetil.org@gnu.org X-Migadu-Flow: FLOW_IN X-Migadu-Country: US X-Migadu-Scanner: mx10.migadu.com X-Migadu-Spam-Score: -2.01 X-Spam-Score: -2.01 X-Migadu-Queue-Id: DC255684D3 X-TUID: dPVek1z5nnAr Hi Simon, Simon Tournier writes: > Hi, > > On sam., 10 f=C3=A9vr. 2024 at 23:43, Maxim Cournoyer wrote: >> * configure.ac: Require Guile-Lib. >> * guix/logging.scm: New module. >> * Makefile.am (MODULES): Register it. >> * guix/ui.scm (show-guix-help): Document --log-level global option. >> (%log-level): New parameter. >> (run-guix-command): Init logging. >> (run-guix): Parse new --log-level option. > > Cool! > > How to synchronize this patch with the Guile-Lib counter-part > > [Guile-Lib PATCH v3 0/7] Make log-msg accept source properties fo= r displaying source location > Maxim Cournoyer > Thu, 08 Feb 2024 23:50:41 -0500 > id:20240209045150.17210-1-maxim.cournoyer@gmail.com > > ? I have commit access to guile-lib; I've pinged its maintainer to see if they have any objection, and otherwise I'll merge it soon. > Aside, just to be sure to well understand, this introduces the logger > but it is not used yet, right? Correct. > >> - guix/lint.scm \ >> + guix/lint.scm \ >> + guix/logging.scm \ > > Well, I assume being the nitpick person here. :-) > > The line guix/lint.scm should not change here. I fixed the number of tabs on the line above as it looked odd in Emacs :-). >> +;;; Copyright =C2=A9 2023, 2024 Maxim Cournoyer > > I think what makes the date of the Copyright is something publicly > declared (published) and not the date when the author started to work on > it. At least, it is how it works for book in France. > > So here the Copyright would be 2024 only, I guess. Most of that code also exists in guile-hall, was released in 2023, hence the copyright year start [0]. [0] https://gitlab.com/a-sassmannshausen/guile-hall/-/blob/master/hall/log= ging.scm >> +(define-syntax define-log-level >> + ;; This macro defines a log-level enum type bound to ENUM-NAME for the >> + ;; provided levels. The levels should be specified in increasing ord= er of >> + ;; severity. It also defines 'log-LEVEL' syntax to more conveniently= log at >> + ;; LEVEL, with location information. > > Why not also a docstring? Only procedures can have docstrings, unfortunately. >> + (lambda (x) >> + (define-syntax-rule (id parts ...) >> + ;; Assemble PARTS into a raw (unhygienic) identifier. >> + (datum->syntax x (symbol-append (syntax->datum parts) ...))) > >> diff --git a/guix/ui.scm b/guix/ui.scm >> index 962d291d2e..f5a6966854 100644 >> --- a/guix/ui.scm >> +++ b/guix/ui.scm >> @@ -44,6 +44,7 @@ (define-module (guix ui) >> #:use-module (guix utils) >> #:use-module (guix store) >> #:use-module (guix config) >> + #:use-module (guix logging) > > [...] > >> + (((? (cut string-prefix? "--log-level=3D" <>) o) args ...) >> + (parameterize ((%log-level (string->symbol >> + (second (string-split o #\=3D))))) >> + (apply run-guix args))) >> + (("--log-level" level args ...) > > This make =E2=80=9C--log-level debug=E2=80=9D valid, right? > > I think the convention is --long-option[=3DPARAMETER] and that > --long-option PARAMTER is unconventional. Although I do not find the > reference. It's not as much a convention as a limitation of the SRFI 37 option parser. GNU getopt, which SRFI 37 aims to emulate, doesn't have such a limitation, for example. We should improve SRFI 37 to lift such limitation, in my opinion. --=20 Thanks, Maxim