MRepoApp / magisk-modules-repo-util

A util for building modules repository
GNU General Public License v3.0
121 stars 25 forks source link

logging: errors should go to STDERR #9

Closed IzzySoft closed 1 year ago

IzzySoft commented 1 year ago

Currently, there's no -q parameter to make scan "quiet" e.g. when running from Cron. Redirecting STDOUT to /dev/null redirects ALL output, including errors – so one would not notice if automated runs had errors.

Errors should hence be directed to STDERR, not STDOUT.

A -q parameter would be welcome, too :wink:

IzzySoft commented 1 year ago

Speaking about logging: would be great to

SanmerDev commented 1 year ago

use a different log level when a real update is done

What does it mean to the real update? 🤔

IzzySoft commented 1 year ago

That you can better control the output. Currently, it's a bit confusing (e.g. why does removing the oldest ZIP as configured yield a WARNING? That's expected behavior and should be INFO at best) and hard to read if you just want to a) see if there were any updates, b) just want a mail from cron in case something failed, or c) want to automatically evaluate if there were any updates at all and a sync should be triggered.

I had to define myself an alias to keep things under control, calling sync like

util/cli.py sync |egrep -v '(update module from|: already the latest|repo_name:|repo_url:|max_num:|show_log:|log_dir:|number of modules|unlimited-hotspot)'

To the update itself it doesn't mean a thing, as nothing would change there. It's just the logging itself we're talking about here.


¹ assuming that e.g. INFO would be mostly what it is now except for when there are really changes – though what goes to which level might be a different discussion later. Using my filters from above, I'd e.g. send

Just rough brain-storming, not having all cases present :wink:

SanmerDev commented 1 year ago

This will take some time, currently I am refactoring and optimizing sync😶‍🌫️.

IzzySoft commented 1 year ago

Yes, sure – you make the schedule as you see fit of course! I saw you've already pushed a bunch of changes :+1: Please let me know when any of those require different handling when updating to HEAD on my end.

SanmerDev commented 1 year ago

Currently, my advice is not to follow HEAD, because sync has a lot of places that will be changed, so I can't ensure the stability of util, I will release it when everything is OK.

I plan to implement version control to ensure that every version of MRepo has the util available. Also, this should make it easier for repositories to migrate when JSON structure changed.

IzzySoft commented 1 year ago

Thanks! Then I wait for your signal on when an update should be safe (together with the details to change or to watch out for). If there's a "stable point" on the road to the next release which you want me to test out, you can give that signal as well (always a good idea having another pair of eyes checking things with a possibly different setup, so the release is as "clean" as possible :wink:)