summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJohnathan Rabkin <yonirabkin@member.fsf.org>2014-02-06 16:06:32 -0500
committerJohnathan Rabkin <yonirabkin@member.fsf.org>2014-02-06 16:06:32 -0500
commit96cc027f2b6893ba67848a51f502230237c3624a (patch)
tree5690e89d6663f8776ee7fa5849e8d14ba0c62cb5
parentecd9c1259325894dd1fc69978c0c22e66833e8d1 (diff)
* rt-liberation.el: Add a debug option.
-rw-r--r--rt-liberation.el25
1 files changed, 25 insertions, 0 deletions
diff --git a/rt-liberation.el b/rt-liberation.el
index b75bebd..3b4cd7a 100644
--- a/rt-liberation.el
+++ b/rt-liberation.el
@@ -179,6 +179,28 @@ The custom field symbols provide the programmer with a consistent
way of referring to certain custom fields. The custom field
strings are the server specific strings.")
+(defvar rt-liber-debug-log-enable nil
+ "If t then enable logging of communication to a buffer.
+
+Careful! This might create a sizable buffer.")
+
+(defvar rt-liber-debug-log-buffer-name "*rt-liber debug log*"
+ "Name of debug log buffer.")
+
+
+;;; --------------------------------------------------------
+;;; Debug log
+;;; --------------------------------------------------------
+
+(defun rt-liber-debug-log-write (str)
+ "Write STR to debug log."
+ (when (not (stringp str))
+ (error "must be a string"))
+ (with-current-buffer (get-buffer-create
+ rt-liber-debug-log-buffer-name)
+ (goto-char (point-max))
+ (insert str)))
+
;;; --------------------------------------------------------
;;; TicketSQL compiler
@@ -314,6 +336,9 @@ AFTER date after predicate."
(with-temp-buffer
(insert answer-string)
(goto-char (point-min))
+ (when rt-liber-debug-log-enable
+ (rt-liber-debug-log-write (buffer-substring (point-min)
+ (point-max))))
(funcall parser-f)))