Emacs 27: C-hig (elisp)Backtraces
Debugger mode is derived from Backtrace mode, which is also used to show
backtraces by Edebug and ERT. (*note Edebug::, and *note the ERT manual:
The backtrace buffer shows you the functions that are executing and
their argument values. When a backtrace buffer is created, it ...
If you are using messages to yourself while developing then:
That's fine - nothing wrong with using message.
You can also define a wrapper for such uses of message, which respects a global variable you define. That gives you a quick way to turn such messages on/off or otherwise affect them.
An alternative is to use debug, to use the Emacs debugger:
Customize the user option C-hv edebug-initial-mode or use M-x edebug-set-initial-mode1 to set the value go instead of the default step.
In the absence of relevant breakpoints, an instrumented function will now simply run to completion without interruption.
Note that you can set breakpoints in an instrumented function with M-x edebug-set-breakpoint or M-x ...
It's possible to format backtraces differently using mapbacktrace with a custom function. One such example is always printing the items as list, I've contributed a patch introducing the debugger-stack-frame-as-list customizable that does that. Check out the implementation of backtrace in Emacs 26.1 or newer.