[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Guile-Lib PATCH v2 5/6] logging: Adjust default log-formatter output.
From: |
Maxim Cournoyer |
Subject: |
[Guile-Lib PATCH v2 5/6] logging: Adjust default log-formatter output. |
Date: |
Mon, 5 Feb 2024 22:41:14 -0500 |
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 <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
- [Guile-Lib PATCH v2 0/6] Make log-msg accept source properties for displaying source location, Maxim Cournoyer, 2024/02/05
- [Guile-Lib PATCH v2 1/6] configure.ac: Fix typo in message., Maxim Cournoyer, 2024/02/05
- [Guile-Lib PATCH v2 2/6] Use /bin/sh in update-api script shebang., Maxim Cournoyer, 2024/02/05
- [Guile-Lib PATCH v2 3/6] tests: guile-library.api: Re-generate., Maxim Cournoyer, 2024/02/05
- [Guile-Lib PATCH v2 4/6] logging: Allow passing source properties to `log-msg'., Maxim Cournoyer, 2024/02/05
- [Guile-Lib PATCH v2 6/6] logger: Call flush-log at the end of accept-log., Maxim Cournoyer, 2024/02/05
- [Guile-Lib PATCH v2 5/6] logging: Adjust default log-formatter output.,
Maxim Cournoyer <=
- [Guile-Lib PATCH v3 0/7] Make log-msg accept source properties for displaying source location, Maxim Cournoyer, 2024/02/08
- [Guile-Lib PATCH v3 1/7] configure.ac: Fix typo in message., Maxim Cournoyer, 2024/02/08
- [Guile-Lib PATCH v3 2/7] Use /bin/sh in update-api script shebang., Maxim Cournoyer, 2024/02/08
- [Guile-Lib PATCH v3 3/7] tests: guile-library.api: Re-generate., Maxim Cournoyer, 2024/02/08
- [Guile-Lib PATCH v3 4/7] logging: Allow passing source properties to `log-msg'., Maxim Cournoyer, 2024/02/08
- [Guile-Lib PATCH v3 5/7] logging: Adjust default log-formatter output., Maxim Cournoyer, 2024/02/08
- [Guile-Lib PATCH v3 6/7] logging: Make procedure name available to the log formatter., Maxim Cournoyer, 2024/02/08
- [Guile-Lib PATCH v3 7/7] logging: Call flush-log at the end of accept-log., Maxim Cournoyer, 2024/02/08