guix-commits
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[shepherd] 03/05: herd: ‘detailed-status’ no longer shows recent message


From: Ludovic Courtès
Subject: [shepherd] 03/05: herd: ‘detailed-status’ no longer shows recent messages.
Date: Sun, 31 Dec 2023 10:28:12 -0500 (EST)

civodul pushed a commit to branch devel
in repository shepherd.

commit 7e2517234e5a6d728c7a2e8b66110b1f22db63b5
Author: Ludovic Courtès <ludo@gnu.org>
AuthorDate: Sun Dec 31 15:55:16 2023 +0100

    herd: ‘detailed-status’ no longer shows recent messages.
    
    * modules/shepherd/scripts/herd.scm (display-service-status):
    Add #:show-recent-messages? and honor it.
    (display-detailed-status): Pass #:show-recent-messages? #f.
---
 modules/shepherd/scripts/herd.scm | 35 +++++++++++++++++++++--------------
 1 file changed, 21 insertions(+), 14 deletions(-)

diff --git a/modules/shepherd/scripts/herd.scm 
b/modules/shepherd/scripts/herd.scm
index 1c70ae1..f4ebf0f 100644
--- a/modules/shepherd/scripts/herd.scm
+++ b/modules/shepherd/scripts/herd.scm
@@ -168,7 +168,10 @@ transient status for too long."
 
 (define (display-detailed-status services)
   "Display the detailed status of SERVICES."
-  (for-each display-service-status services))
+  (for-each (lambda (service)
+              (display-service-status service
+                                      #:show-recent-messages? #f))
+            services))
 
 (define (time->string time)
   "Return a string representing TIME in a concise, human-readable way."
@@ -226,8 +229,11 @@ transient status for too long."
 
 (define* (display-service-status service
                                  #:key
+                                 (show-recent-messages? #t)
                                  (log-history-size %default-log-history-size))
-  "Display the status of SERVICE, an sexp."
+  "Display the status of @var{service}, an sexp.  When
+@var{show-recent-messages?} is true, display messages recently logged by
+@var{service}."
   (format #t (highlight (l10n "Status of ~a:~%"))
           (live-service-canonical-name service))
 
@@ -297,18 +303,19 @@ transient status for too long."
                (time->string time)))
       (_ #t)))
 
-  (match (live-service-recent-messages service)
-    (() #t)
-    (messages
-     (newline)
-     (format #t (highlight (l10n "Recent messages:~%")))
-     (for-each (match-lambda
-                 ((time . line)
-                  (format #t "  ~a~a~%"
-                          (strftime default-logfile-date-format
-                                    (localtime time))
-                          line)))
-               (reverse (at-most log-history-size messages))))))
+  (when show-recent-messages?
+    (match (live-service-recent-messages service)
+      (() #t)
+      (messages
+       (newline)
+       (format #t (highlight (l10n "Recent messages:~%")))
+       (for-each (match-lambda
+                   ((time . line)
+                    (format #t "  ~a~a~%"
+                            (strftime default-logfile-date-format
+                                      (localtime time))
+                            line)))
+                 (reverse (at-most log-history-size messages)))))))
 
 (define (display-event-log services)
   "Display status changes of @var{services} as a chronologically-sorted log."



reply via email to

[Prev in Thread] Current Thread [Next in Thread]