From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp2.migadu.com ([2001:41d0:403:58f0::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms8.migadu.com with LMTPS id z2M2DoDfzWUMOgAAe85BDQ:P1 (envelope-from ) for ; Thu, 15 Feb 2024 10:55:12 +0100 Received: from aspmx1.migadu.com ([2001:41d0:403:58f0::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp2.migadu.com with LMTPS id z2M2DoDfzWUMOgAAe85BDQ (envelope-from ) for ; Thu, 15 Feb 2024 10:55:12 +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=QQmLKbud; 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=1707990911; 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=ZIpGHA/nonr7E+zTXo9DzkwIE8NLc2FirsGmrV7lLbQ=; b=sclxiYLVfMxsWfy3nNaGaGJ+jrtv0fSrDmwzYc230U14Ols7f1LP6sNd1NvQ9j9dMFBTNq K2ZqGrtGgU2SJvfkL/Zo7Pm8WlCTyuJRfzTQgD41KnVXhSjMtC+YsstLTu7EPfGFSLYsrj DnsVDPRfPkTDvX2XLSeGHLizf2wLJlJlqhm7mLCkPn8+A4r+AUQLCiOmtQPcknONf/wvEZ RVph//4xujfCHXdxb3DSq8L3fvfaAbV7fz0xVwwsmaSuV4TeWn9MS0j+ZwPfCV6gKD+IjT DakNHT40s2sqhnnq4ptX7facyrClYLiywT605MrQVWtRWTA7iVItMolrb9qsIg== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=fail ("headers rsa verify failed") header.d=gmail.com header.s=20230601 header.b=QQmLKbud; 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=1707990911; a=rsa-sha256; cv=none; b=MbHNNe5W/6DLn5LylTfAN+EByudbb2AdjZHlvD8v1zEgKU9QoMVp59ul7GNlYZJy1OFP63 2BX8nU1oyEEk0WsG+ctQcHcbxaStzVsf4R4AFUq9pQgjJbNszvIyPZex/9kAED1DrDZgeH HNuYK3sHPgSeglzjw3W2rca0KAX3+STNYYCNurk4skZUTzXYcNR0NPUMStp9ZzGPdc0Kcu s1qZvAdhxGl8dhW+zv/Wdmy+xWkTmYVAgqyW0fPJD001r5vRneWwZ3sBdUolfL8fHvO/Sq 0aDeMt+ASdTp5Sd1uIwspkvJiXqyuKC1dKOD8FZJMxkSNeVPjx5kPX/f1JNo6w== 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 C69D6595B5 for ; Thu, 15 Feb 2024 10:55:11 +0100 (CET) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1raYS6-0003Vo-Sa; Thu, 15 Feb 2024 04:54:46 -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 1raYS5-0003OF-1R for guix-patches@gnu.org; Thu, 15 Feb 2024 04:54:45 -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 1raYS4-0001Ve-Ou for guix-patches@gnu.org; Thu, 15 Feb 2024 04:54:44 -0500 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1raYSN-000310-9W for guix-patches@gnu.org; Thu, 15 Feb 2024 04:55:03 -0500 X-Loop: help-debbugs@gnu.org Subject: [bug#68946] [PATCH v2] guix: Add logging module. Resent-From: Simon Tournier Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Thu, 15 Feb 2024 09:55:03 +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: Maxim Cournoyer , 68946@debbugs.gnu.org Cc: Josselin Poiret , Maxim Cournoyer , Mathieu Othacehe , Ludovic =?UTF-8?Q?Court=C3=A8s?= , Tobias Geerinckx-Rice , Ricardo Wurmus , Christopher Baines Received: via spool by 68946-submit@debbugs.gnu.org id=B68946.170799088911526 (code B ref 68946); Thu, 15 Feb 2024 09:55:03 +0000 Received: (at 68946) by debbugs.gnu.org; 15 Feb 2024 09:54:49 +0000 Received: from localhost ([127.0.0.1]:54118 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1raYS6-0002zh-3S for submit@debbugs.gnu.org; Thu, 15 Feb 2024 04:54:49 -0500 Received: from mail-wr1-f51.google.com ([209.85.221.51]:41215) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1raYS1-0002z0-LT for 68946@debbugs.gnu.org; Thu, 15 Feb 2024 04:54:42 -0500 Received: by mail-wr1-f51.google.com with SMTP id ffacd0b85a97d-33cfc38c203so99940f8f.0 for <68946@debbugs.gnu.org>; Thu, 15 Feb 2024 01:54:22 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1707990797; x=1708595597; darn=debbugs.gnu.org; h=content-transfer-encoding:mime-version:message-id:date:references :in-reply-to:subject:cc:to:from:from:to:cc:subject:date:message-id :reply-to; bh=ZIpGHA/nonr7E+zTXo9DzkwIE8NLc2FirsGmrV7lLbQ=; b=QQmLKbudbg5cuhwZlh8ATecChxkry9mxlLpBl+lTOR9kumBha0/4zBYXrkR3yhFTko A6oxQGIgFvzvJKwR9eebQdG+8cndHjYbfgg4lXgPOrwfaTevWT4desyQN9R8O6CXq+Ai z/Fiu4FH5jq/H9ZLL5fAVjAee8DUhVvgC/kza89cipchRCV6d24jowv5id9yh7zJS1X6 dKLMkbjlAaqO/cdQ2lxUOlZKYOEbF33zP/4GFhVTSJmJKRymTccN+TVuJSHro2EY2pZM Co9yg2JNOlHfaturb8p3cEpUVF5DV4mefvrI0dZgwFSz38srnaYcXUtt/f6DP2F4xz5V RtJg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1707990797; x=1708595597; h=content-transfer-encoding:mime-version: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=ZIpGHA/nonr7E+zTXo9DzkwIE8NLc2FirsGmrV7lLbQ=; b=sWLIQzXd1mYxqn9ReTryINLnhGhSYIlR9ds7p1xDJzkqinCaNTo1kXE2pCq6Ey/Obt YIpBO7z/ceC8uoTYLBIbdpDc7aqmAV7ZlFsuqxaDrSapvKDeeQMulsgSNBoulZdj7aBH 0N735NFiQbnxCTllup29LkSWGLPp5TPi/u0Kp14oUzHMnFPUu7G8SUhOIq4JioVpVppe XbTfyxUMMgW9so01SjCvlCAIR/hMA3ks+/Iqwr5jYP8aXbtSdDm15rBDlTRrii0miEGk 2X/XUXArBl6KpwtfRYu7B32uxRzm62pgoTynvM6hiGSA23Y6DgUi69RA7Ihzc4Vzvq2y caHg== X-Forwarded-Encrypted: i=1; AJvYcCWTYyrZpmWYLo2H5QOkoWRboIgnCm4kO+COjf2DX3viUCrxoN7vA6fYhOIfHTo7PlcdYmfrq90VTkNQAGusBMIRFVBZ+Xk= X-Gm-Message-State: AOJu0YwT4igmOVFQN2/PjRr0gxvhHK6bnKHDtSzmKtUMlB8awG23+l0L pbU6QnVR9r97I3hbDHyfrLNQNestPWX4bslkpnrQ+zxFHSpOyXUK X-Google-Smtp-Source: AGHT+IH+9I7/+0G+sWbycUN75sYjTyq3/84gNV4I+TwqwGRq/LKNebuofIxvBcCrmn6IRitT4+NVzw== X-Received: by 2002:a05:600c:3b02:b0:410:e8d0:5575 with SMTP id m2-20020a05600c3b0200b00410e8d05575mr1023923wms.1.1707990797367; Thu, 15 Feb 2024 01:53:17 -0800 (PST) Received: from lili ([2a01:e0a:59b:9120:7d85:9c0b:111:5112]) by smtp.gmail.com with ESMTPSA id o4-20020a05600c4fc400b00411d0b58056sm1470119wmq.5.2024.02.15.01.53.16 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 15 Feb 2024 01:53:16 -0800 (PST) From: Simon Tournier In-Reply-To: <0b81168e693a21f7fb08bd7677a5cc3120418fc9.1707626620.git.maxim.cournoyer@gmail.com> References: <0b81168e693a21f7fb08bd7677a5cc3120418fc9.1707626620.git.maxim.cournoyer@gmail.com> Date: Wed, 14 Feb 2024 15:47:49 +0100 Message-ID: <87frxvm7ai.fsf@gmail.com> 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-Country: US X-Migadu-Flow: FLOW_IN X-Migadu-Spam-Score: -3.87 X-Spam-Score: -3.87 X-Migadu-Queue-Id: C69D6595B5 X-Migadu-Scanner: mx11.migadu.com X-TUID: FdTeSq92aKt/ 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 for = displaying source location Maxim Cournoyer Thu, 08 Feb 2024 23:50:41 -0500 id:20240209045150.17210-1-maxim.cournoyer@gmail.com ? Aside, just to be sure to well understand, this introduces the logger but it is not used yet, right? > - 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. > +;;; 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. > +(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 orde= r of > + ;; severity. It also defines 'log-LEVEL' syntax to more conveniently = log at > + ;; LEVEL, with location information. Why not also a docstring? > + (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. (also -sPARAMTER or -s PARAMETER)