summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJose Antonio Ortega Ruiz <jao@gnu.org>2010-10-31 15:51:57 +0100
committerJose Antonio Ortega Ruiz <jao@gnu.org>2010-10-31 15:51:57 +0100
commit9325189d4b3cfa2207c015b4f60cf397089edc9f (patch)
tree3c7012e65377b5194f144379e8178eac0889c828
parentdff681a7e5641f350c0d18c178b7401e75b107d6 (diff)
downloadgeiser-chez-9325189d4b3cfa2207c015b4f60cf397089edc9f.tar.gz
geiser-chez-9325189d4b3cfa2207c015b4f60cf397089edc9f.tar.bz2
Informational logs disabled by default
Set geiser-log-verbose-p to t to enable all logs. Calling geiser-show-logs with a prefix argument will do that for you.
-rw-r--r--elisp/geiser-log.el27
1 files changed, 18 insertions, 9 deletions
diff --git a/elisp/geiser-log.el b/elisp/geiser-log.el
index 150e6f3..d078b19 100644
--- a/elisp/geiser-log.el
+++ b/elisp/geiser-log.el
@@ -1,6 +1,6 @@
;; geiser-log.el -- logging utilities
-;; Copyright (C) 2009 Jose Antonio Ortega Ruiz
+;; Copyright (C) 2009, 2010 Jose Antonio Ortega Ruiz
;; This program is free software; you can redistribute it and/or
;; modify it under the terms of the Modified BSD License. You should
@@ -28,11 +28,11 @@
(defvar geiser-log--max-buffer-size 32000
"Maximum size of the Geiser messages log.")
-(defvar geiser-log--max-message-size 512
+(defvar geiser-log--max-message-size 2048
"Maximum size of individual Geiser log messages.")
-(defvar geiser-log--verbose-p t
- "Log level for Geiser messages")
+(defvar geiser-log-verbose-p nil
+ "Log purely informational messages. Useful for debugging.")
(defvar geiser-log--inhibit-p nil
"Set this to t to inhibit all log messages")
@@ -61,7 +61,9 @@
(defun geiser-log--msg (type &rest args)
(unless geiser-log--inhibit-p
(geiser-log--with-buffer
- (insert (geiser--shorten-str (format "\n%s: %s\n" type (apply 'format args))
+ (goto-char (point-max))
+ (insert (geiser--shorten-str (format "\n%s: %s\n" type
+ (apply 'format args))
geiser-log--max-message-size)))))
(defsubst geiser-log--warn (&rest args)
@@ -71,17 +73,24 @@
(apply 'geiser-log--msg 'ERROR args))
(defsubst geiser-log--info (&rest args)
- (when geiser-log--verbose-p
+ (when geiser-log-verbose-p
(apply 'geiser-log--msg 'INFO args) ""))
;;; User commands:
-(defun geiser-show-logs ()
- "Show Geiser log messages."
- (interactive)
+(defun geiser-show-logs (&optional arg)
+ "Show Geiser log messages.
+With prefix, activates all logging levels."
+ (interactive "P")
+ (when arg (setq geiser-log-verbose-p t))
(geiser-log--pop-to-buffer))
+(defun geiser-log-clear ()
+ "Clean all logs."
+ (interactive)
+ (geiser-log--with-buffer (delete-region (point-min) (point-max))))
+
(provide 'geiser-log)
;;; geiser-log.el ends here