On 2024-06-02, Christian Brabandt wrote:
> On Sa, 01 Jun 2024, Gary Johnson wrote:
> 
> > I would like to request that developers not leave calls to ch_log()
> > enabled in released code, that is, in code that has been committed
> > to the GitHub repo.
> > 
> > I just tried debugging some Vim code by sprinkling calls to ch_log()
> > in it.  When I ran tail on the log file, I was inundated with log
> > messages from other sources, making it hard to find mine.  To quiet
> > the log, I put #if 0/#endif around several calls in
> > 
> >     channel.c
> >     evalfunc.c
> >     main.c
> >     ops.c
> >     os_unix.c
> >     ui.c
> > 
> > It would be nice if the responsible developers would fix those in
> > the manner they prefer, since the project doesn't seem to have
> > a uniform solution for this, such as the one used in term.c.
> > 
> > Perhaps a note about not leaving calls to ch_log() enabled when
> > you're done debugging should be added to src/README.md.
> 
> I thought the idea was that you can use `--log file` and have a log with 
> all kind of information that can be used even with released versions of 
> Vim. So I have used it e.g. to debug what keys are received by Vim when 
> a user complains certain keys don't work in alacritty or kitty terminal. 
> 
> If we disable the calls to ch_log() we wouldn't be able to debug those, 
> no?

True, but the log can become so noisy as to be useless for debugging
any other problem.  It seems we have two conflicting needs.

What I've seen on other projects is for there to be groups of debug
print statements, with each group assigned one of 32 bits.  These
were enabled at compile time for debugging in the lab rather than in
the field, but it could be done at run time, either as
a command-line argument or a function call.  Such groups could be
given names instead of bits to make the UI friendlier and more
extensible.

Another, simpler approach would be to add a global, compile-time
macro that would be enabled for releases, but could be disabled by
a developer to quiet all those terminal-related calls to ch_log().
That would allow a developer wanting to use ch_log() for their own
purposes to simply add something like -DNOTERMDEBUG or -UTERMDEBUG
to the CFLAGS in their environment.

Regards,
Gary

-- 
-- 
You received this message from the "vim_dev" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

--- 
You received this message because you are subscribed to the Google Groups 
"vim_dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to vim_dev+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/vim_dev/20240602190531.GC31154%40phoenix.

Raspunde prin e-mail lui