<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
</head>
<body>
<p>
<blockquote type="cite">for unknown reasons, the values accepted
by verbose() and logpost() have an offset.
</blockquote>
Why? Oh why?</p>
<p>I have to admit I only checked with verbose() (which is used
extensively in the Pd source code) and naively assumed that
logpost() would work the same... <br>
</p>
<p>Here's a possible solution:</p>
<p>If we let PD_CRITICAL start at 5 (or even higher), then both
verbose() and logpost() can differentiate between the old and the
new log levels and add the respective offsets.</p>
<pre>if (loglevel >= PD_CRITICAL) {
// new log level
} else {
// old log level
}</pre>
<p>Since people would just use the enum values, they don't have to
care about the actual numeric values anyway. I know, it is not
aesthetically pleasing, but it would solve the issue at hand.</p>
<p>Christof<br>
</p>
<div class="moz-cite-prefix">On 24.08.2021 15:59, IOhannes m
zmoelnig wrote:<br>
</div>
<blockquote type="cite"
cite="mid:02113e2f-d09f-6cb4-bc88-c25201fc985b@iem.at">TL;DR i'd
like to propose to unify the loglevels as used by verbose() and
logpost()
<br>
<br>
<br>
for unknown reasons, the values accepted by verbose() and
logpost() have an offset.
<br>
<br>
the current loglevels are like this:
<br>
<br>
logpost(x, 0,...) -> CRITICAL
<br>
logpost(x, 1,...) -> ERROR
<br>
logpost(x, 2,...) -> NORMAL
<br>
logpost(x, 3,...) -> DEBUG
<br>
logpost(x, 4,...) -> extra VERBOSE
<br>
<br>
verbose(-3,...) -> CRITICAL
<br>
verbose(-2,...) -> ERROR
<br>
verbose(-1,...) -> NORMAL
<br>
verbose(0,...) -> DEBUG
<br>
verbose(1,...) -> extra VERBOSE
<br>
<br>
for Pd-0.52, christof has created an enum to use labels that are
easier to read and understand (PD_CRITICAL, PD_ERROR, PD_NORMAL,
PD_DEBUG, PD_VERBOSE).
<br>
to add a bit of confusion, this enum is called "t_loglevel" but
actually declares values that are usable by verbose() rather than
logpost()
<br>
<br>
i would like to have both logpost() and verbose() use the same
values (which should be aliased via the "t_loglevel" enum).
<br>
<br>
<br>
unfortunately, both methods are used by (a few) externals, so
unifying the levels will change the verbosity of these externals.
<br>
<br>
my gut feeling tells me, that i would prefer the current behaviour
or logpost() (with the most severe loglevel starting at 0, rather
than some negative value).
<br>
alternatively, i think that a loglevel=0 should be the verbosity
of [print] (aka NORMAL). however, this would change the verbosity
of *all* libraries using any of verbose() or loglevel().
<br>
<br>
to see how bad a change would be, i've tried to check how many
externals are actually using any of the two functions:
<br>
<br>
and luckily, there are not that many externals involved.
<br>
<br>
these results are based on externals i found on my harddisk
<br>
<br>
* externals using `verbose()`
<br>
- zexy: mostly uses verbose(1) to report errors
<br>
- iemguts (canvasdelete, autoabstraction): only calls verbose()
once!
<br>
- triggerize-plugin, doublechord-plugin: uses verbose(10), which
is "extra verbose" in all scenarios, so can be ignored)
<br>
- mediasettings
<br>
- hexloader
<br>
- Gem
<br>
- ggee (shell): uses verbose(4) which is always "extra verbose"
<br>
- hcs (folderlist)
<br>
- tclpd
<br>
- vstplugin~
<br>
<br>
* externals using `logpost()`
<br>
- hcs (ce_path, folder_list, passwd, helppath, classpath, stat,
group, colorpanel)
<br>
- vbap
<br>
- iemnet
<br>
- iemmatrix: only extra VERBOSE
<br>
- maxlib: only extra VERBOSE
<br>
- unauthorized: only extra VERBOSE
<br>
- libdir: only DEBUG and above
<br>
- mrpeach (midifile, tcpclient): only DEBUG
<br>
- lua: only DEBUG
<br>
- tclpd: only DEBUG
<br>
- cyclone: original version uses only extra VERBOSE; porres'
version doesn't use logpost() at all
<br>
- creb
<br>
- smlib
<br>
- log
<br>
<br>
i'm sure i missed many libraries, but i checked quite a few.
<br>
<br>
<br>
anyhow:
<br>
<br>
changing the levels used by verbose() to be "0"-based will make
externals (that use verbose()) more chatty.
<br>
however, afaict, Gem and vstplugin~ are the only libraries in wide
use where this might actually become an issue. and i guess
"vstplugin~" is being actively enough developed to fix the problem
by just pushing out a new version.
<br>
<br>
otoh, changing the levels used by logpost() to be "-3"-based will
make externals (that use logpost()) less chatty.
<br>
in general this shouldn't be a big deal (as people can always
raise the verbosity to see these messages).
<br>
in particular, many libraries using logpost() are very quiet
anyhow (using DEBUG or extra VERBOSE), so there won't be that much
change.
<br>
<br>
<br>
what do you think?
<br>
<br>
<br>
fdasr
<br>
IOhannes
<br>
<br>
<br>
<fieldset class="mimeAttachmentHeader"></fieldset>
<pre class="moz-quote-pre" wrap="">_______________________________________________
Pd-dev mailing list
<a class="moz-txt-link-abbreviated" href="mailto:Pd-dev@lists.iem.at">Pd-dev@lists.iem.at</a>
<a class="moz-txt-link-freetext" href="https://lists.puredata.info/listinfo/pd-dev">https://lists.puredata.info/listinfo/pd-dev</a>
</pre>
</blockquote>
</body>
</html>