@@ -417,7 +417,9 @@ permissions are not as expected.
Log output into @var{file}.
For unprivileged users, the default log file is
-@file{$XDG_CONFIG_HOME/shepherd/shepherd.log}.
+@file{$XDG_CACHE_HOME/shepherd/shepherd.log}. If the
+@code{XDG_CACHE_HOME} environment variable is not defined,
+@code{$HOME/.cache/shepherd/shepherd.log} is used instead.
@cindex syslog
When running as root, the default behavior is to connect to
@@ -4,6 +4,7 @@
;; Copyright (C) 2002, 2003 Wolfgang Jährling <wolfgang@pro-linux.de>
;; Copyright (C) 2016 Mathieu Lirzin <mthl@gnu.org>
;; Copyright (C) 2018 Danny Milosavljevic <dannym@scratchpost.org>
+;; Copyright (C) 2020 Jan (janneke) Nieuwenhuizen <janneke@gnu.org>
;;
;; This file is part of the GNU Shepherd.
;;
@@ -265,6 +266,12 @@ There is NO WARRANTY, to the extent permitted by law.")))
(false-if-exception (passwd:dir (getpwuid (getuid))))
"/"))
+(define %user-cache-dir
+ ;; Default cache directory if shepherd is run as a normal user.
+ (string-append (or (getenv "XDG_CACHE_HOME")
+ (string-append user-homedir "/.cache"))
+ "/shepherd"))
+
(define %user-config-dir
;; Default config directory if shepherd is run as a normal user.
(string-append (or (getenv "XDG_CONFIG_HOME")
@@ -302,8 +309,8 @@ TARGET should be a string representing a filepath + name."
;; Logging.
(define (user-default-log-file)
"Return the file name of the user's default log file."
- (mkdir-p %user-config-dir #o700)
- (string-append %user-config-dir "/shepherd.log"))
+ (mkdir-p %user-cache-dir #o700)
+ (string-append %user-cache-dir "/shepherd.log"))
(define default-logfile-date-format
;; 'strftime' format string to prefix each entry in the log.