Function: verb-util--log

verb-util--log is a natively compiled function defined in verb-util.el.

Signature

(verb-util--log REQUEST LEVEL &rest ARGS)

Documentation

Log a message in the *Verb Log* buffer.

REQUEST must be a number corresponding to an HTTP request made. LEVEL must be a value in verb-util--log-levels. Use the remaining ARGS to call format, and then log the result in the log buffer.

If verb-enable-log is nil, do not log anything.

Source Code

;; Defined in /nix/store/8jnfn8w2mxcxbr2crbklcnija9m0zlkq-emacs-packages-deps/share/emacs/site-lisp/elpa/verb-20260818.1921/verb-util.el
(defun verb-util--log (request level &rest args)
  "Log a message in the *Verb Log* buffer.
REQUEST must be a number corresponding to an HTTP request made.  LEVEL
must be a value in `verb-util--log-levels'.  Use the remaining ARGS to call
`format', and then log the result in the log buffer.

If `verb-enable-log' is nil, do not log anything."
  (setq request (if request (number-to-string request) "-"))
  (unless (member level verb-util--log-levels)
    (user-error "Invalid log level: \"%s\"" level))
  (when (bound-and-true-p verb-enable-log) ; Var is defined in verb.el.
    (with-current-buffer (get-buffer-create verb-util--log-buffer-name)
      (unless (derived-mode-p 'verb-util-log-mode)
        (verb-util-log-mode))
      (let ((inhibit-read-only t)
            (last "")
            (msg (apply #'format args)))
        (unless (= (buffer-size) 0)
          (insert "\n"))
        ;; Get last logged request number.
        (when (re-search-backward "^\\(-\\|[[:digit:]]+\\)\\s-"
                                  nil t)
          (setq last (match-string 1)))
        (goto-char (point-max))
        ;; Log new message.
        (insert (format "%-5s %s  "
                        (if (string= last request)
                            (make-string (length request) ? )
                          request)
                        level)
                msg)
        ;; If logged messaged contained newlines, add a blank line
        ;; to make things more readable.
        (when (string-match-p "\n" msg)
          (newline)))
      (dolist (w (get-buffer-window-list (current-buffer) nil t))
        (set-window-point w (point-max))))))