From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Maxim Cournoyer Newsgroups: gmane.lisp.guile.devel Subject: [Guile-Lib PATCH v2 5/6] logging: Adjust default log-formatter output. Date: Mon, 5 Feb 2024 22:41:14 -0500 Message-ID: <20240206034201.28494-6-maxim.cournoyer@gmail.com> References: <20240205194049.7757-1-maxim.cournoyer@gmail.com> <20240206034201.28494-1-maxim.cournoyer@gmail.com> Mime-Version: 1.0 Content-Transfer-Encoding: 8bit Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="12393"; mail-complaints-to="usenet@ciao.gmane.io" Cc: David Pirotte , Maxim Cournoyer To: guile-devel@gnu.org Original-X-From: guile-devel-bounces+guile-devel=m.gmane-mx.org@gnu.org Tue Feb 06 04:43:08 2024 Return-path: Envelope-to: guile-devel@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1rXCMW-000358-Bd for guile-devel@m.gmane-mx.org; Tue, 06 Feb 2024 04:43:08 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rXCLh-0006Mf-5b; Mon, 05 Feb 2024 22:42:17 -0500 Original-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 1rXCLf-0006M0-GO for guile-devel@gnu.org; Mon, 05 Feb 2024 22:42:15 -0500 Original-Received: from mail-qv1-xf2a.google.com ([2607:f8b0:4864:20::f2a]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1rXCLd-0002eP-Rj for guile-devel@gnu.org; Mon, 05 Feb 2024 22:42:15 -0500 Original-Received: by mail-qv1-xf2a.google.com with SMTP id 6a1803df08f44-6818aa07d81so31393586d6.0 for ; Mon, 05 Feb 2024 19:42:13 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1707190931; x=1707795731; darn=gnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=DF17g5+oR2GGGJ+UGK3W9UffbbCzXa0kGUaHqEV+/XY=; b=g2VW06H4DWgCyld+ACly5W1XB5PdFmFloJru+iK70Q/AhMDIlaDWm/sN3iLsNkqzM3 NkVm7r9TwpQngkCZytcB2YvVBW8jBHORH9PdXKDwkCpS9IeI5AvI/cGEN90riNvBI3pb oDdxHw/j+B3y6AHhQnhX5qn4MT7DOuRntJLapBQkqRPYlOafIbGeI8mbZJVtnXZFrzef rnAT5lnq7rUGccfq0WExDrDvUrpzpPNgUskVNPadORk1POh+27OcZJ6T3BoiLLHIQ1eT mk8GaPtlsnCOr3fqXehTfw4X4akj24+Ej7M2c1SHWcFPTdDQatetecPhBUavXNLDcMHQ swLw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1707190931; x=1707795731; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=DF17g5+oR2GGGJ+UGK3W9UffbbCzXa0kGUaHqEV+/XY=; b=IEMMH2KRIDgM6T6400wJOawwj1VvFeCiR6kA0qk76k0hmK2jbosJguBCzcjY4RkZ+A hxKz/DeVTQ7lZt+0URzW/zZuU03EH2lai37tX44zkP2CUmnRClE3weiqZ4v+F8l04+Ta 2wIb6+FFOZ73Porn6LsLZkl18nnBldv3TGkBqdRuE/yq0N5P4wxyDXVpakoUMzrY5VP2 dhRNjgTZg8WrlhPga3hEFJ+Hvqckmwfa8yh+ttH6JjjVHaqXxA6Ql7EJLoz62k4d4wU2 9O8Z7ooX2ETjp6Nf2PzGHBUQPvBW66kygZZpPHS2jwX4oHxTRQ77qyih8FMGxSVyyBTD aIKQ== X-Gm-Message-State: AOJu0YzXZM+XG5crROPk9QzU5dYLfhJ94vlsnq81Z1DVefOdyn4sSbv9 2gMKU4xF02Vjcw+U0/wLMo3T/IKPbFgZLkyV55hmtUzJsXNadw4DvazJeZS9 X-Google-Smtp-Source: AGHT+IGe+l1SeMbTYjCerwiYHn+gJ+uNM8m9EuSdWDcbWt6pq81I8FoNCl61uBFkrChIPKfPYXKRWQ== X-Received: by 2002:a05:6214:2427:b0:68c:8f8e:12ab with SMTP id gy7-20020a056214242700b0068c8f8e12abmr1412214qvb.52.1707190930492; Mon, 05 Feb 2024 19:42:10 -0800 (PST) X-Forwarded-Encrypted: i=0; AJvYcCW95uggrxdfFvWxwzBMC/bQ7ZJMP8VJL+/wfPykPE/SpNTIhVNbobgm/ccTLaNsMX+UTeOtAKlS6iCimtP4mJbq2o+QxGyglOoc Original-Received: from localhost.localdomain (dsl-10-130-152.b2b2c.ca. [72.10.130.152]) by smtp.gmail.com with ESMTPSA id mv6-20020a056214338600b0068c963dd12asm626458qvb.86.2024.02.05.19.42.09 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 05 Feb 2024 19:42:10 -0800 (PST) X-Mailer: git-send-email 2.41.0 In-Reply-To: <20240206034201.28494-1-maxim.cournoyer@gmail.com> Received-SPF: pass client-ip=2607:f8b0:4864:20::f2a; envelope-from=maxim.cournoyer@gmail.com; helo=mail-qv1-xf2a.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: guile-devel@gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "Developers list for Guile, the GNU extensibility library" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: guile-devel-bounces+guile-devel=m.gmane-mx.org@gnu.org Original-Sender: guile-devel-bounces+guile-devel=m.gmane-mx.org@gnu.org Xref: news.gmane.io gmane.lisp.guile.devel:22301 Archived-At: The log level is always in uppercase, and its surrounding parentheses are dropped. * src/logging/logger.scm (default-log-formatter): Uppercase level and strip its surrounding parens. * unit-tests/logging.logger.scm: Adjust expected output accordingly. --- (no changes since v1) src/logging/logger.scm | 6 +++--- unit-tests/logging.logger.scm | 6 +++--- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/src/logging/logger.scm b/src/logging/logger.scm index 1e4f2e7..e57cd44 100644 --- a/src/logging/logger.scm +++ b/src/logging/logger.scm @@ -299,9 +299,9 @@ syntactic wrapper (currently left to the user to implement)." (format #t " ~a:~a:" (1+ line) column)) ((('filename . file-name) ('line . line) ('column . column)) (format #t " ~a:~a:~a:" file-name (1+ line) column))) - (display " (") - (display (symbol->string lvl)) - (display "): ") + (display " ") + (display (string-upcase (symbol->string lvl))) + (display ": ") (display str) (newline)))) diff --git a/unit-tests/logging.logger.scm b/unit-tests/logging.logger.scm index d26587c..2093bf2 100644 --- a/unit-tests/logging.logger.scm +++ b/unit-tests/logging.logger.scm @@ -30,7 +30,7 @@ (lgr (make #:handlers (list (make #:port strport))))) (open-log! lgr) (log-msg lgr 'CRITICAL "Hello!") - (assert-equal "(CRITICAL): Hello!\n" + (assert-equal "CRITICAL: Hello!\n" ;; skip over the time/date, since that will vary! (substring (get-output-string strport) 20)))) @@ -41,7 +41,7 @@ (set-default-logger! lgr) (log-msg 'CRITICAL "Hello!") (set-default-logger! #f) - (assert-equal "(CRITICAL): Hello!\n" + (assert-equal "CRITICAL: Hello!\n" ;; skip over the time/date, since that will vary! (substring (get-output-string strport) 20)))) @@ -50,7 +50,7 @@ (lgr (make #:handlers (list (make #:port strport))))) (register-logger! "main" lgr) (log-msg (lookup-logger "main") 'CRITICAL "Hello!") - (assert-equal "(CRITICAL): Hello!\n" + (assert-equal "CRITICAL: Hello!\n" ;; skip over the time/date, since that will vary! (substring (get-output-string strport) 20)))) -- 2.41.0