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 5/6] logging: Adjust default log-formatter output. Date: Mon, 5 Feb 2024 14:40:35 -0500 Message-ID: <20240205194049.7757-6-maxim.cournoyer@gmail.com> References: <20240205194049.7757-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="19583"; 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 Mon Feb 05 20:41:54 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 1rX4qo-0004uV-OM for guile-devel@m.gmane-mx.org; Mon, 05 Feb 2024 20:41:54 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rX4q7-0005sx-PT; Mon, 05 Feb 2024 14:41:11 -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 1rX4q6-0005sh-KO for guile-devel@gnu.org; Mon, 05 Feb 2024 14:41:10 -0500 Original-Received: from mail-oi1-x234.google.com ([2607:f8b0:4864:20::234]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1rX4q5-0003ek-1k for guile-devel@gnu.org; Mon, 05 Feb 2024 14:41:10 -0500 Original-Received: by mail-oi1-x234.google.com with SMTP id 5614622812f47-3be48947186so2739254b6e.3 for ; Mon, 05 Feb 2024 11:41:08 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1707162067; x=1707766867; 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=1A24ZJdCIlvzKKoBE8J3xP6DRUU//TttgZAtPooUETQ=; b=UFhUGnYhzWRuKmnpduL1TIdei8ujxKTOdm2rWYn+vfOZAU5fwEIHa5y1w/EPzKW5sz 1fE7HTjTeXyUZ7+PzNc2x8FYlFY4hKFdCxgFDRu3XdddWuy0t6nmLYgrwOJPOWM5jkj6 WVf+74pvyfuJc4th9W9M0iYHuZ36mIJCY/1jrBzqhM6YC/BS7nCnvLncAkOP9rzmDHpv IldpJKrGR9bdPArUmBq1hB0c0mlt/Ps7TvFW9QvD83JdEOEFFyrQuD8YBujg03SAcgul AVA7fXECpi8HQaoERlvchna101AWlmQffL7k4H4PMWrGXS/LlHvnZfS0mQg1HimguAoA x00g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1707162067; x=1707766867; 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=1A24ZJdCIlvzKKoBE8J3xP6DRUU//TttgZAtPooUETQ=; b=FkLevYeFKjbnWlktk9FRkP+RsJLe2bDEkG3SCe6iy9ptPzcFkUHXaN7oUfCQbNbbUb dqI1KbKDrpF250PskrF7rIs2k6RfjXItS92QwMHgQNued+mvMta/XhHd+o9rkZ6vLHET wQTDeTOtC2C9XIVA6iwZ1QHzs83xDVeubXVHktiPX4MmWjcutssSHlIetJcBCu1T1dVH ei/98l2t//kEkAC453oKvmldSacwldcEU5hPE8hjgNLF3vRqvEmtJ/UXRXuYXFliPV5o IdkU7z3XRBLZyEv7kLS27JXVcLXI80/Wrb/zl3RGFqD8TqHNyuBBB9yHbtpgj8Cc5Av/ qdgQ== X-Gm-Message-State: AOJu0YxmZe8RlXIm3qsGCLttQt+EivNk35nay00WK5IdBHFUN+z7kcHg th39e/dE2v93CX6bZNB4GT19hau+plFzJyYAfA8B3zdGA/cL4G5EOsLdKOmg X-Google-Smtp-Source: AGHT+IHowXN6OkR68PE5np5KvxfAVZBq9H8MpMQAczce/x0aXvpGtniIvy8tbkH3zbngjRJs5g41uQ== X-Received: by 2002:a05:6808:6548:b0:3bf:dfeb:7cd8 with SMTP id fn8-20020a056808654800b003bfdfeb7cd8mr905532oib.7.1707162067177; Mon, 05 Feb 2024 11:41:07 -0800 (PST) X-Forwarded-Encrypted: i=0; AJvYcCV2ZisLyqlsKUj2LUocqzCJVDw5RMyINHrY3dVe9gyPM6YWDkukt15Pjn2m4DyD9IvttP5Et9Nagh+atovI8ocq8ZNaxK5OdahU Original-Received: from localhost.localdomain (dsl-10-130-152.b2b2c.ca. [72.10.130.152]) by smtp.gmail.com with ESMTPSA id a12-20020a05620a102c00b00783da2644besm217367qkk.136.2024.02.05.11.41.06 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 05 Feb 2024 11:41:06 -0800 (PST) X-Mailer: git-send-email 2.41.0 In-Reply-To: <20240205194049.7757-1-maxim.cournoyer@gmail.com> Received-SPF: pass client-ip=2607:f8b0:4864:20::234; envelope-from=maxim.cournoyer@gmail.com; helo=mail-oi1-x234.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:22291 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. --- 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 982c44d..5403531 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