procrastinate icon indicating copy to clipboard operation
procrastinate copied to clipboard

Wrong documentation about verbose option

Open medihack opened this issue 1 year ago • 4 comments
trafficstars

The documentation says that PROCRASTINATE_VERBOSE env variable can be set to change the verbosity of the worker. It is even set in some tests. On the other hand the CLI just uses VERBOSE env var. Or is the PROCRASTINATE_ prefix somehow added automagically?

The documentation also says that the verbosity is controlled by using v multiple times and that there are 3 levels. But there are actually four levels and those are controlled by an integer.

medihack avatar Jun 22 '24 22:06 medihack

Just found out that it works a bit differently in the Django command. The normal procrastinate command supports the multiple v option.

medihack avatar Jun 22 '24 22:06 medihack

Yep, the PROCRASTINATE_ prefix is added automatically

It used to be a feature from click but we had to stop using click due to async issues so we had to redevelop this behaviour on our side.

Regarding the -v behaviour, is there a place in the docs where this should be explicited ?

ewjoachim avatar Jun 23 '24 06:06 ewjoachim

Yep, the PROCRASTINATE_ prefix is added automatically

Thanks, good to know.

It used to be a feature from click but we had to stop using click due to async issues so we had to redevelop this behaviour on our side.

Regarding the -v behaviour, is there a place in the docs where this should be explicited ?

There seems to be some differences between the basic procrastinate command and the Django alternative ./manage.py procrastinate.

The basic command tells me in the help info about verbose:

-v, --verbose  Use multiple times to increase verbosity (env: PROCRASTINATE_VERBOSE: set to desired verbosity level) (default: 0)

The Django command on the other side prints out this in the help info:

-v {0,1,2,3}, --verbosity {0,1,2,3} Verbosity level; 0=minimal output, 1=normal output, 2=verbose output, 3=very verbose output

The Django command does not accept something like -vv.

The documentation also states that there are 3 different log levels for verbose. But the above Django help info says that there are 4 log levels. And from looking at the code there are indeed only two levels. So it's a bit confusing 😉.

medihack avatar Jun 23 '24 10:06 medihack

Hm, true that, I think at some point we switched from default to warning to defaulting to info.

(I wonder if we should revisit this choice, but nobody complained. If that's really something people want to change, they can make their own executable that uses whatever value they want.)

And yes, Django manages its own -v in management commands. Could be worth piggy-backing on that (https://reinout.vanrees.org/weblog/2017/03/08/logging-verbosity-managment-commands.html) though we'll still have level mismatch.

Shouldn't be hard to explain wherever relevant in the doc.

ewjoachim avatar Jun 23 '24 10:06 ewjoachim