GNU bug report logs -
#61982
[PATCH 0/2] Respect XDG Base Directory Specification 0.8.
Previous Next
Reported by: Bruno Victal <mirai <at> makinata.eu>
Date: Sun, 5 Mar 2023 15:18:02 UTC
Severity: normal
Tags: patch
Done: Andrew Tropin <andrew <at> trop.in>
Bug is archived. No further changes may be made.
Full log
View this message in rfc822 format
[Message part 1 (text/plain, inline)]
On Sun Apr 9, 2023 at 8:09 PM BST, Philip McGrath wrote:
> > I meant introducing something like this
> > (define (get-log-dir)
> > (string-append
> > (getenv "XDG_STATE_HOME") "/log"))
> >
>
> Within the XDG directories, I think (unless perhaps you only use a single file) you are supposed to keep everything in a subdirectory named for your application (or with a well-known name for things shared among multiple applications). For example, on my system, I can find log files in "$XDG_DATA_HOME/akonadi/Akonadi.error", "$XDG_DATA_HOME/akonadi/Akonadi.error.old", "$XDG_DATA_HOME/sddm/wayland-session.log", and "$XDG_DATA_HOME/sddm/xorg-session.log". (Apparently SDDM and Akonadi haven't been updated to use $XDG_STATE_HOME.) I think Guix Home services should follow that convention, rather than putting all logs together in "$XDG_STATE_HOME/log/".
So it turns out Shepherd provides these gems squirreled away inside its
(shepherd support) module:
```
(define %user-config-dir
;; Default config directory if shepherd is run as a normal user.
(string-append (or (getenv "XDG_CONFIG_HOME")
(string-append user-homedir "/.config"))
"/shepherd"))
(define %user-log-dir
;; Default log directory if shepherd is run as a normal user.
(string-append (or (getenv "XDG_STATE_HOME")
(string-append user-homedir "/.local/state"))
"/shepherd"))
(define %user-runtime-dir
;; Default runtime directory if shepherd is run as a normal user.
(string-append (or (getenv "XDG_RUNTIME_DIR")
(format #f "/run/user/~s" (getuid)))))
```
Shepherd already provides us with a %USER-LOG-DIR variable :D
-- (
[signature.asc (application/pgp-signature, inline)]
This bug report was last modified 2 years and 28 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.