mirror of https://github.com/morpheus65535/bazarr
logger: use default formatter in case of debug
This commit is contained in:
parent
ef09482a36
commit
b3a3a8e957
|
@ -44,8 +44,8 @@ def configure_logging(debug=False):
|
||||||
|
|
||||||
# Console logging
|
# Console logging
|
||||||
ch = logging.StreamHandler()
|
ch = logging.StreamHandler()
|
||||||
cf = NoExceptionFormatter('%(asctime)-15s - %(name)-32s (%(thread)x) : %(levelname)s (%(module)s:%(lineno)d) '
|
cf = (debug and logging.Formatter or NoExceptionFormatter)(
|
||||||
'- %(message)s')
|
'%(asctime)-15s - %(name)-32s (%(thread)x) : %(levelname)s (%(module)s:%(lineno)d) - %(message)s')
|
||||||
ch.setFormatter(cf)
|
ch.setFormatter(cf)
|
||||||
|
|
||||||
ch.setLevel(log_level)
|
ch.setLevel(log_level)
|
||||||
|
@ -95,6 +95,7 @@ class BlacklistFilter(logging.Filter):
|
||||||
"""
|
"""
|
||||||
Log filter for blacklisted tokens and passwords
|
Log filter for blacklisted tokens and passwords
|
||||||
"""
|
"""
|
||||||
|
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
super(BlacklistFilter, self).__init__()
|
super(BlacklistFilter, self).__init__()
|
||||||
|
|
||||||
|
@ -120,6 +121,7 @@ class PublicIPFilter(logging.Filter):
|
||||||
"""
|
"""
|
||||||
Log filter for public IP addresses
|
Log filter for public IP addresses
|
||||||
"""
|
"""
|
||||||
|
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
super(PublicIPFilter, self).__init__()
|
super(PublicIPFilter, self).__init__()
|
||||||
|
|
||||||
|
@ -132,7 +134,8 @@ class PublicIPFilter(logging.Filter):
|
||||||
|
|
||||||
args = []
|
args = []
|
||||||
for arg in record.args:
|
for arg in record.args:
|
||||||
ipv4 = re.findall(r'[0-9]+(?:\.[0-9]+){3}(?!\d*-[a-z0-9]{6})', arg) if isinstance(arg, basestring) else []
|
ipv4 = re.findall(r'[0-9]+(?:\.[0-9]+){3}(?!\d*-[a-z0-9]{6})', arg) if isinstance(arg,
|
||||||
|
basestring) else []
|
||||||
for ip in ipv4:
|
for ip in ipv4:
|
||||||
arg = arg.replace(ip, ip.partition('.')[0] + '.***.***.***')
|
arg = arg.replace(ip, ip.partition('.')[0] + '.***.***.***')
|
||||||
args.append(arg)
|
args.append(arg)
|
||||||
|
|
Loading…
Reference in New Issue