Hello Guix!

The ‘wip-logging’ branch of the Shepherd contains changes that allow
clients such ‘herd status’ to display recently-logged messages, like
this:

--8<---------------cut here---------------start------------->8---
$ ./herd -s sock status test-logging
Status of test-logging:
  It is running since 22:41:51 (7 seconds ago).
  Running value is 31389.
  It is enabled.
  Provides (test-logging).
  Requires ().
  Will be respawned.

Recent messages:
  2023-12-04 22:41:58 logging logging logging logging logging
  2023-12-04 22:41:58 logging logging logging logging logging
  2023-12-04 22:41:58 logging logging logging logging logging
  2023-12-04 22:41:58 logging logging logging logging logging
  2023-12-04 22:41:58 logging logging logging logging logging
  2023-12-04 22:41:58 logging logging logging logging logging
  2023-12-04 22:41:58 logging logging logging logging logging
  2023-12-04 22:41:58 logging logging logging logging logging
  2023-12-04 22:41:58 logging logging logging logging logging
  2023-12-04 22:41:58 logging logging logging logging logging
--8<---------------cut here---------------end--------------->8---

Another *cough* popular service manager provides a facility that looks
like this and I find it convenient.

Internally, shepherd maintains a ring buffer of the last lines printed
by each service.  To do that, the first step was to establish a
connection between the “logger” and the service it’s associated with—so
far, the logging mechanism was started by ‘fork+exec-command’, which
doesn’t know what service it’s working for.  Loggers are now actors that
services can query to get those last messages.

The changes so far look like this:

  627ad75 herd: ‘status’ displays recently-logged messages.
  0b44232 service: Communicate recently-logged messages to clients.
  823beae service: Associate loggers with services; keep buffer of logged lines.
  cc8ea8a service: Built-in logger logs the PID of the service.
  088997a service: Thread the current service to actions.
  3302861 service: Move line-by-line log reading to a separate fiber.

Thoughts?

I suppose that’s maybe more for the next stable series (1.0!) than for
0.10.x.

Cheers,
Ludo’.

  • Shepherd service ... Ludovic Courtès
    • Re: Shepherd... Development of GNU Guix and the GNU System distribution.
      • Re: Shep... Attila Lendvai
        • No p... Development of GNU Guix and the GNU System distribution.
          • ... Ludovic Courtès
            • ... Development of GNU Guix and the GNU System distribution.

Reply via email to