emacs-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: New (only?) extensible logging package for Emacs


From: Matúš Goljer
Subject: Re: New (only?) extensible logging package for Emacs
Date: Mon, 13 Mar 2023 16:59:49 +0100

Eli Zaretskii <eliz@gnu.org> writes:

>> From: Matúš Goljer <matus.goljer@gmail.com>
>> Cc: emacs-devel@gnu.org
>> Date: Mon, 13 Mar 2023 14:28:31 +0100
>> 
>> :emergency = fatal
>> :error     = error
>> :warning   = warn
>>    ...     = info
>> :debug     = debug
>>    ...     = trace
>> 
>> In Emacs, I guess info is basically `message`, so maybe this "warnings"
>> appender should `message` info level events.  Trace could go to debug or
>> be ignored.
>> 
>> I like to have more than one level of "debug", in some situations you
>> want to only see some narrow part of the code at even higher level.
>
> I hope the log will end up in Emacs buffers, or at least that there
> will be an option to do so.  While other logging frameworks are
> designed to work with programs that leave log files, in Emacs it is
> customary to have the log in a buffer (and then the user can save that
> buffer if needed).

If you mean the "info" level logs I said we can log with message (the
function), they would end up in *Messages* but of course can go to some
other separate buffer.

I will also add a generic buffer appender where you can give it
buffer-or-name and logs will go there.

> Direct writes of debug info to files is rare in Emacs (see
> open-dribble-file and open-termscript as about the only examples I'm
> aware of).

My most immediate use-case for this package is the development of Elsa,
where I also develop a Language Server for LSP and use emacs-async with
async workers.  Having flexible appending logic in these subprocesses
allows me to use the single interface (say lgr-info) to dispatch
messages to:

- client via LSP notifications
- parent process via async-send
- CLI when running elsa from terminal

All just by configuring the loggers at the start of each process.

For use inside Emacs session for debugging etc, a buffer seems like an
obvious log destination.

-- 
Best regards,
  Matúš Goljer



reply via email to

[Prev in Thread] Current Thread [Next in Thread]