Re: logging in emacs

Michael Heerdegen via "Emacs development discussions." <[email protected]>
Newsgroups gmane.emacs.devel
Message-ID <[email protected]>
Thomas Koch <[email protected]> writes:

> I was wondering what the right way would be to write log messages in
> Emacs, considering also that I wanted to avoid composing messages if
> logging were turned off.

The right way depends on what you want.  Most of the time simple calls
to `message' are good enough, maybe in combination with
`inhibit-message' bound so that the messages are not displayed when you
don't want that.  But I can't tell whether you want your log messages
merged into *Messages* or not.  Neither is wrong.

There is a standard interface for warnings OTOH, but no higher-level
standard for any arbitrary kind of log messages, AFAICT.

> Fun fact: AI suggested to me that it would be idiomatic to Emacs to
> use a macro as a log function. However none (except sh-debug) of the
> above is a macro.

No - but all log functions in Emacs use AI to generate output.  It would
not be possible without.  It's just too hard, look, I tried:

  (log "A log message to the user") ~~> error


Michael.
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.