unofficial mirror of guile-devel@gnu.org 
 help / color / mirror / Atom feed
From: Maxim Cournoyer <maxim.cournoyer@gmail.com>
To: guile-devel@gnu.org
Cc: David Pirotte <david@altosw.be>,
	Maxim Cournoyer <maxim.cournoyer@gmail.com>
Subject: [Guile-Lib PATCH 5/6] logging: Adjust default log-formatter output.
Date: Mon,  5 Feb 2024 14:40:35 -0500	[thread overview]
Message-ID: <20240205194049.7757-6-maxim.cournoyer@gmail.com> (raw)
In-Reply-To: <20240205194049.7757-1-maxim.cournoyer@gmail.com>

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 <logger> #:handlers (list (make <port-log> #: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 <logger> #:handlers (list (make <port-log> #: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




  parent reply	other threads:[~2024-02-05 19:40 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-02-05 19:40 [Guile-Lib PATCH 0/6] Make log-msg accept source properties for displaying source location Maxim Cournoyer
2024-02-05 19:40 ` [Guile-Lib PATCH 1/6] configure.ac: Fix typo in message Maxim Cournoyer
2024-02-05 19:40 ` [Guile-Lib PATCH 2/6] Use /bin/sh in update-api script shebang Maxim Cournoyer
2024-02-05 19:40 ` [Guile-Lib PATCH 3/6] tests: guile-library.api: Re-generate Maxim Cournoyer
2024-02-05 19:40 ` [Guile-Lib PATCH 4/6] logging: Allow passing source properties to `log-msg' Maxim Cournoyer
2024-02-05 19:40 ` Maxim Cournoyer [this message]
2024-02-05 19:40 ` [Guile-Lib PATCH 6/6] logger: Call flush-log at the end of accept-log Maxim Cournoyer

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/guile/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20240205194049.7757-6-maxim.cournoyer@gmail.com \
    --to=maxim.cournoyer@gmail.com \
    --cc=david@altosw.be \
    --cc=guile-devel@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).