From 9325189d4b3cfa2207c015b4f60cf397089edc9f Mon Sep 17 00:00:00 2001 From: Jose Antonio Ortega Ruiz Date: Sun, 31 Oct 2010 15:51:57 +0100 Subject: 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. --- elisp/geiser-log.el | 27 ++++++++++++++++++--------- 1 file changed, 18 insertions(+), 9 deletions(-) (limited to 'elisp') 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 -- cgit v1.2.3