FMCorz / mdk

Moodle Development Kit. A collection of tools meant to make developers' lives easier.
GNU General Public License v3.0
85 stars 47 forks source link

URL to see precheck result details not always displayed #158

Closed mudrd8mz closed 6 years ago

mudrd8mz commented 6 years ago

Currently, the code

logging.info('More details at: %s', infos.get('url'))

is used to produce the URL where the user can find the URL with the precheck command results (typically to see the smurf file). I think that is suboptimal. I had the default debug level set to "WARNING" and thence that URL was never displayed to me (and I only found this because I thought it was a missing feature).

Let me suggest to use the print call to always display this link, regardless the logging level setting - same to what is currently used to print the precheck summary. Or at least always print the URL if the precheck has some warnings / errors.

In other words, taking https://docs.python.org/2/howto/logging.html as a reference, I consider that URL be expected "console output for ordinary usage of a command line script" rather than a report of an event to be logged.

I'll be happy to prepare the pull request for either alternative agreed. Thanks.

FMCorz commented 6 years ago

Sounds like a fair change. I guess I used logging because I thought the output could be processed by another tool fairly easily by simply outputting the result. But I don't see any issue using print for the URL as well.

You are right that logging should not be used when a script should print something, that's why you'll notice a fair usage of prints in other commands info, config, ... I generally use logging for what I consider to be invisible should we have --quiet option.

FMCorz commented 6 years ago

Fixed by #159.