mirror of
https://github.com/ch11ng/exwm.git
synced 2024-11-27 04:58:00 +01:00
Add timestamps to `exwm-debug' logs
* exwm-core.el (exwm-debug-log-time-function): New user option for choosing the style of timestamps in debug logs. (exwm-debug-log-uptime, exwm-debug-log-time): Possible candidates for it. (exwm--log): Use it.
This commit is contained in:
parent
f303517c29
commit
2d36241a10
1 changed files with 25 additions and 1 deletions
26
exwm-core.el
26
exwm-core.el
|
@ -33,6 +33,27 @@
|
|||
(require 'xcb-ewmh)
|
||||
(require 'xcb-debug)
|
||||
|
||||
(defcustom exwm-debug-log-time-function #'exwm-debug-log-uptime
|
||||
"Function used for generating timestamps in `exwm-debug' logs.
|
||||
|
||||
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
|
||||
: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] "))
|
||||
|
||||
(defvar exwm--connection nil "X connection.")
|
||||
|
||||
(defvar exwm--wmsn-window nil
|
||||
|
@ -79,7 +100,10 @@ FORMAT-STRING is a string specifying the message to output, as in
|
|||
`format'. The OBJECTS arguments specify the substitutions."
|
||||
(unless format-string (setq format-string ""))
|
||||
`(when exwm-debug
|
||||
(xcb-debug:message ,(concat "%s:\t" format-string "\n")
|
||||
(xcb-debug:message ,(concat "%s%s:\t" format-string "\n")
|
||||
(if exwm-debug-log-time-function
|
||||
(funcall exwm-debug-log-time-function)
|
||||
"")
|
||||
(xcb-debug:compile-time-function-name)
|
||||
,@objects)
|
||||
nil))
|
||||
|
|
Loading…
Reference in a new issue