From 96cc027f2b6893ba67848a51f502230237c3624a Mon Sep 17 00:00:00 2001 From: Johnathan Rabkin Date: Thu, 6 Feb 2014 16:06:32 -0500 Subject: * rt-liberation.el: Add a debug option. --- rt-liberation.el | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) 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))) -- cgit v1.2.3