Function: tramp-message

tramp-message is a byte-compiled function defined in tramp.el.gz.

Signature

(tramp-message VEC-OR-PROC LEVEL FMT-STRING &rest ARGUMENTS)

Documentation

Emit a message depending on verbosity level.

VEC-OR-PROC identifies the Tramp buffer to use. It can be either a vector or a process. LEVEL says to be quiet if tramp-verbose is less than LEVEL. The message is emitted only if tramp-verbose is greater than or equal to LEVEL.

The message is also logged into the debug buffer when tramp-verbose is greater than or equal 4.

Calls functions message and tramp-debug-message with FMT-STRING as control string and the remaining ARGUMENTS to actually emit the message (if applicable).

Source Code

;; Defined in /usr/src/emacs/lisp/net/tramp.el.gz
(defsubst tramp-message (vec-or-proc level fmt-string &rest arguments)
  "Emit a message depending on verbosity level.
VEC-OR-PROC identifies the Tramp buffer to use.  It can be either a
vector or a process.  LEVEL says to be quiet if `tramp-verbose' is
less than LEVEL.  The message is emitted only if `tramp-verbose' is
greater than or equal to LEVEL.

The message is also logged into the debug buffer when `tramp-verbose'
is greater than or equal 4.

Calls functions `message' and `tramp-debug-message' with FMT-STRING as
control string and the remaining ARGUMENTS to actually emit the message (if
applicable)."
  (ignore-errors
    (when (<= level tramp-verbose)
      ;; Display only when there is a minimum level, and the progress
      ;; reporter doesn't suppress further messages.
      (when (and (<= level 3) (null tramp-inhibit-progress-reporter))
	(apply #'message
	       (concat
		(cond
		 ((= level 0) "")
		 ((= level 1) "")
		 ((= level 2) "Warning: ")
		 (t           "Tramp: "))
		fmt-string)
	       arguments))
      ;; Log only when there is a minimum level.
      (when (>= tramp-verbose 4)
	(let ((tramp-verbose 0))
	  ;; Append connection buffer for error messages, if exists.
	  (when (= level 1)
	    (ignore-errors
	      (with-current-buffer
		  (if (processp vec-or-proc)
		      (process-buffer vec-or-proc)
		    (tramp-get-connection-buffer vec-or-proc 'dont-create))
		(setq fmt-string (concat fmt-string "\n%s")
		      arguments (append arguments (list (buffer-string)))))))
	  ;; Translate proc to vec.
	  (when (processp vec-or-proc)
	    (setq vec-or-proc (process-get vec-or-proc 'vector))))
	;; Do it.
	(when (tramp-file-name-p vec-or-proc)
	  (apply #'tramp-debug-message
		 vec-or-proc
		 (concat (format "(%d) # " level) fmt-string)
		 arguments))))))