Skip to content

Commit

Permalink
Make undercover--message a macro
Browse files Browse the repository at this point in the history
Don't even evaluate the log arguments if the level is above the
verbosity.
  • Loading branch information
CyberShadow committed Jun 2, 2021
1 parent 14f9e5a commit 990f9f4
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions undercover.el
Original file line number Diff line number Diff line change
Expand Up @@ -154,11 +154,11 @@ LEVEL is ignored in this default implementation."
(ignore level)
(apply #'message (concat "UNDERCOVER: " format-string) args))

(defun undercover--message (level format-string &rest args)
"Call `undercover-message-function'."
(defmacro undercover--message (level format-string &rest args)
"Call `undercover-message-function', if the configured verbosity allows it."
(declare (indent 1))
(when (<= level undercover--verbosity)
(apply undercover-message-function level format-string args)))
`(when (<= ,level undercover--verbosity)
(apply undercover-message-function ,level ,format-string (list ,@args))))


;; ----------------------------------------------------------------------------
Expand Down

0 comments on commit 990f9f4

Please sign in to comment.