Simplify use of Tramp messages
* doc/misc/tramp.texi (Traces and Profiles): Don't require a minimum `tramp-verbose' level when `tramp-debug-command-messages' is non-nil. * lisp/net/tramp-message.el (tramp-debug-command-messages): Adapt docstring. (tramp-message, with-tramp-debug-message): Don't require a minimum `tramp-verbose' level when `tramp-debug-command-messages' is non-nil.
This commit is contained in:
parent
e3207b13ce
commit
fedaf25bb3
2 changed files with 47 additions and 46 deletions
|
@ -6125,9 +6125,8 @@ performance of @value{tramp} actions.
|
|||
If @code{tramp-verbose} is greater than or equal to 11, @value{tramp}
|
||||
function call traces are written to the buffer @file{*trace tramp/foo*}.
|
||||
|
||||
When @code{tramp-debug-command-messages} is non-@code{nil} and
|
||||
@code{tramp-verbose} is greater than or equal to 6, the debug buffer
|
||||
contains all messages with verbosity level 6 (sent and received
|
||||
When @code{tramp-debug-command-messages} is non-@code{nil}, the debug
|
||||
buffer contains all messages with verbosity level 6 (sent and received
|
||||
strings), and the entry and exit messages for the function
|
||||
@code{tramp-file-name-handler}. This is intended for @value{tramp}
|
||||
maintainers, analyzing the remote commands for performance analysis.
|
||||
|
|
|
@ -32,9 +32,8 @@
|
|||
;; This buffer is created when `tramp-verbose' is greater than or
|
||||
;; equal 4. It contains all messages with a level up to `tramp-verbose'.
|
||||
;;
|
||||
;; When `tramp-debug-command-messages' is non-nil and
|
||||
;; `tramp-verbose' is greater than or equal 6, the buffer contains
|
||||
;; all messages with level 6 and the entry/exit messages of
|
||||
;; When `tramp-debug-command-messages' is non-nil, the buffer
|
||||
;; contains all messages with level 6 and the entry/exit messages of
|
||||
;; `tramp-file-name-handler'. This is intended to analyze which
|
||||
;; remote commands are sent for a given file name operation.
|
||||
;;
|
||||
|
@ -85,7 +84,7 @@ The debug file has the same name as the debug buffer, written to
|
|||
|
||||
(defcustom tramp-debug-command-messages nil
|
||||
"Whether to write only command messages to the debug buffer.
|
||||
This has only effect if `tramp-verbose' is greater than or equal 6."
|
||||
This increases `tramp-verbose' to 6 if necessary."
|
||||
:group 'tramp
|
||||
:version "30.1"
|
||||
:type 'boolean)
|
||||
|
@ -298,44 +297,47 @@ control string and the remaining ARGUMENTS to actually emit the message (if
|
|||
applicable)."
|
||||
;; (declare (tramp-suppress-trace t))
|
||||
(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
|
||||
(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.
|
||||
(when (processp vec-or-proc)
|
||||
(setq vec-or-proc (process-get vec-or-proc 'tramp-vector))))
|
||||
;; 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))))))
|
||||
(let ((tramp-verbose
|
||||
(if tramp-debug-command-messages
|
||||
(max tramp-verbose 6) tramp-verbose)))
|
||||
(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
|
||||
(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.
|
||||
(when (processp vec-or-proc)
|
||||
(setq vec-or-proc (process-get vec-or-proc 'tramp-vector))))
|
||||
;; 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)))))))
|
||||
|
||||
;; We cannot use the `declare' form for `tramp-suppress-trace' in
|
||||
;; autoloaded functions, because the tramp-loaddefs.el generation
|
||||
|
@ -531,7 +533,7 @@ Bound in `tramp-*-file-name-handler' functions.")
|
|||
If BODY does not raise a debug message, MESSAGE is ignored."
|
||||
(declare (indent 2) (debug t))
|
||||
(let ((result (make-symbol "result")))
|
||||
`(if (and tramp-debug-command-messages (>= tramp-verbose 6))
|
||||
`(if tramp-debug-command-messages
|
||||
(save-match-data
|
||||
(let ((tramp-debug-nesting
|
||||
(concat tramp-debug-nesting "#"))
|
||||
|
|
Loading…
Add table
Reference in a new issue