Function: tramp-message

tramp-message is an autoloaded and byte-compiled function defined in tramp-message.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-message.el.gz
;;;###tramp-autoload
(defun 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)."
  ;; (declare (tramp-suppress-trace t))
  (ignore-errors
    (let ((tramp-verbose
	   (if tramp-debug-command-messages
	       (max tramp-verbose 6) tramp-verbose)))
      (when (<= level tramp-verbose)
	;; 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
		(setq fmt-string (concat fmt-string "\n%s")
		      arguments
		      (append
		       arguments
		       `(,(tramp-get-buffer-string
			   (if (processp vec-or-proc)
			       (process-buffer vec-or-proc)
			     (tramp-get-connection-buffer
			      vec-or-proc 'dont-create))))))))
	    ;; Translate proc to vec.  Handle nil vec.
	    (when (processp vec-or-proc)
	      (setq vec-or-proc (process-get vec-or-proc 'tramp-vector)))
	    (setq vec-or-proc (tramp-file-name-unify vec-or-proc)))
	  ;; Do it.
	  (when (and (tramp-file-name-p vec-or-proc)
		     (or (null tramp-debug-command-messages) (= level 6)))
	    (apply #'tramp-debug-message
		   vec-or-proc
		   (concat (format "(%d) # " level) fmt-string)
		   arguments)))
	;; 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))))))