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.
This commit is contained in:
Dimitri Fontaine 2017-10-16 17:26:07 +02:00
parent b36f36b74e
commit a28e9b3556

View File

@ -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