about summary refs log tree commit diff
diff options
context:
space:
mode:
authorChris Feng <chris.w.feng@gmail.com>2019-09-15T00·00+0000
committerChris Feng <chris.w.feng@gmail.com>2019-09-15T00·00+0000
commit16d643dd3b2b8e468dbbfb2ad03d7abe41fdf94d (patch)
tree8d50f46a97042a88d14a8eb67699f0d086189ee2
parent559e56f4732d47ba459fb5cdc4246cb22d77d484 (diff)
Fix timestamp for debug logs
* exwm-core.el (exwm-debug-log-time-function): Moved to `exwm-debug'
group and set `xcb-debug:log-time-function' automatically.
(exwm-debug-log-uptime, exwm-debug-log-time): Reuse the definition
from XELB.
-rw-r--r--exwm-core.el23
1 files changed, 13 insertions, 10 deletions
diff --git a/exwm-core.el b/exwm-core.el
index b0a683999da9..9e2829165ca6 100644
--- a/exwm-core.el
+++ b/exwm-core.el
@@ -40,19 +40,22 @@ Here are some predefined candidates:
 `exwm-debug-log-uptime': Display the uptime of this Emacs instance.
 `exwm-debug-log-time': Display time of day.
 `nil': Disable timestamp."
-  :group 'exwm
+  :group 'exwm-debug
   :type `(choice (const :tag "Emacs uptime" ,#'exwm-debug-log-uptime)
                  (const :tag "Time of day" ,#'exwm-debug-log-time)
                  (const :tag "Off" nil)
-                 (function :tag "Other")))
-
-(defun exwm-debug-log-uptime ()
-  "Add uptime to `exwm-debug' logs."
-  (emacs-uptime "[%.2h:%.2m:%.2s] "))
-
-(defun exwm-debug-log-time ()
-  "Add time of day to `exwm-debug' logs."
-  (format-time-string "[%T] "))
+                 (function :tag "Other"))
+  :set (lambda (symbol value)
+         (set-default symbol value)
+         ;; Also change the format for XELB to make logs consistent
+         ;; (as they share the same buffer).
+         (setq xcb-debug:log-time-function value)))
+
+(defalias 'exwm-debug-log-uptime 'xcb-debug:log-uptime
+  "Add uptime to `exwm-debug' logs.")
+
+(defalias 'exwm-debug-log-time 'xcb-debug:log-time
+  "Add time of day to `exwm-debug' logs.")
 
 (defvar exwm--connection nil "X connection.")