[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] externals/exwm 2d36241 1/6: Add timestamps to `exwm-debug' logs
From: |
Chris Feng |
Subject: |
[elpa] externals/exwm 2d36241 1/6: Add timestamps to `exwm-debug' logs |
Date: |
Sun, 8 Sep 2019 09:07:08 -0400 (EDT) |
branch: externals/exwm
commit 2d36241a10b4b705e1482322383f135bca7ac184
Author: Chris Feng <address@hidden>
Commit: Chris Feng <address@hidden>
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.
---
exwm-core.el | 26 +++++++++++++++++++++++++-
1 file changed, 25 insertions(+), 1 deletion(-)
diff --git a/exwm-core.el b/exwm-core.el
index d3edb14..ed9a523 100644
--- a/exwm-core.el
+++ b/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))
- [elpa] externals/exwm updated (f303517 -> cb96078), Chris Feng, 2019/09/08
- [elpa] externals/exwm 2d36241 1/6: Add timestamps to `exwm-debug' logs,
Chris Feng <=
- [elpa] externals/exwm 6593236 2/6: Handle and skip problematic per-application configurations, Chris Feng, 2019/09/08
- [elpa] externals/exwm 323e919 3/6: ; Improve the docstring of `exwm-manage-configurations', Chris Feng, 2019/09/08
- [elpa] externals/exwm cb96078 6/6: ; Autoload `exwm-enable', Chris Feng, 2019/09/08
- [elpa] externals/exwm 5fbf20b 5/6: ; Improve messages for automatically created workspaces, Chris Feng, 2019/09/08
- [elpa] externals/exwm ccc4cce 4/6: Fix floating X window size with menu-bar/tool-bar enabled, Chris Feng, 2019/09/08