From a28e9b355644eb68fc5cbaac0fcf755d0a247130 Mon Sep 17 00:00:00 2001 From: Dimitri Fontaine Date: Mon, 16 Oct 2017 17:26:07 +0200 Subject: [PATCH] Prevent evaluating unused arguments in log-message. A stop-gap has been installed to prevent sending too much trafic to the monitor, but the log-message arguments were still evaluated, and the :data level output from format-row-in-batch is pretty costly. --- src/utils/monitor.lisp | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/utils/monitor.lisp b/src/utils/monitor.lisp index 91af9f0..569e4e2 100644 --- a/src/utils/monitor.lisp +++ b/src/utils/monitor.lisp @@ -42,7 +42,13 @@ (format stream "FATAL: Failed to start the monitor thread.~%") (format stream "~%~a~%" (monitor-real-error err))))) -(defun log-message (category description &rest arguments) +(defmacro log-message (category description &rest arguments) + "Protect against evaluating ARGUMENTS in cases where we don't log at the + given CATEGORY log-level." + `(when (cl-log::category-messengers ,category) + (send-log-message ,category ,description ,@arguments))) + +(defun send-log-message (category description &rest arguments) "Send given message into our monitoring queue for processing." (when (cl-log::category-messengers category) (send-event (make-log-message :category category