mirror of
https://github.com/f-droid/fdroidserver.git
synced 2025-09-13 14:32:28 +03:00
Always use the same logging format
This helps differentiate errors, warnings and regular messages.
This commit is contained in:
parent
48645072ee
commit
73f9c1d1c2
1 changed files with 7 additions and 4 deletions
11
fdroid
11
fdroid
|
@ -99,12 +99,15 @@ def main():
|
||||||
verbose = any(s in sys.argv for s in ['-v', '--verbose'])
|
verbose = any(s in sys.argv for s in ['-v', '--verbose'])
|
||||||
quiet = any(s in sys.argv for s in ['-q', '--quiet'])
|
quiet = any(s in sys.argv for s in ['-q', '--quiet'])
|
||||||
|
|
||||||
|
# Helpful to differentiate warnings from errors even when on quiet
|
||||||
|
logformat = '%(levelname)s: %(message)s'
|
||||||
|
loglevel = logging.INFO
|
||||||
if verbose:
|
if verbose:
|
||||||
logging.basicConfig(format='%(levelname)s: %(message)s', level=logging.DEBUG)
|
loglevel = logging.DEBUG
|
||||||
elif quiet:
|
elif quiet:
|
||||||
logging.basicConfig(format='%(message)s', level=logging.WARN)
|
loglevel = logging.WARN
|
||||||
else:
|
|
||||||
logging.basicConfig(format='%(message)s', level=logging.INFO)
|
logging.basicConfig(format=logformat, level=loglevel)
|
||||||
|
|
||||||
if verbose and quiet:
|
if verbose and quiet:
|
||||||
logging.critical("Specifying --verbose and --quiet and the same time is silly")
|
logging.critical("Specifying --verbose and --quiet and the same time is silly")
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue