Commit cd057e1d authored by Vincent Pelletier's avatar Vincent Pelletier

Save a string concatenation per log line when not required.

parent 3c1a4794
......@@ -678,8 +678,8 @@ DURATION_US_FORMAT = '%D'
DURATION_S_FORMAT = '%T'
server_name_group_dict = {
'%v': lambda x: x.group('servername') + '/',
'%V': lambda x: x.group('canonical_servername') + '/',
'%v': lambda x, path: x.group('servername') + '/' + path,
'%V': lambda x, path: x.group('canonical_servername') + '/' + path,
}
logformat_dict = {
......@@ -1174,7 +1174,7 @@ def main():
parser.error('--match-servername %s requested, but missing '
'from logformat.' % args.match_servername)
get_url_prefix = server_name_group_dict.get(args.match_servername,
lambda _: '')
lambda _, path: path)
line_regex = ''
expensive_line_regex = ''
try:
......@@ -1318,7 +1318,7 @@ def main():
url = url_match.group('url')
if url.startswith('http'):
url = splithost(splittype(url)[1])[1]
url = get_url_prefix(match) + url
url = get_url_prefix(match, url)
for site, prefix_match, action in site_list:
if prefix_match(url) is not None:
break
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment