From: Joshua Kugler Date: Sat, 9 Jul 2011 04:20:04 +0000 (-0800) Subject: Added option to use new friendly names, will not break backward compatibility X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=3eaa939bf40c42228ec5dcffea23c4f4f8af7acc;p=apachelog.git Added option to use new friendly names, will not break backward compatibility --- diff --git a/apachelog.py b/apachelog.py index 9f7c203..f6724f0 100755 --- a/apachelog.py +++ b/apachelog.py @@ -196,7 +196,7 @@ class parser: '%O':'bytes_sent', } - def __init__(self, format): + def __init__(self, format, use_names=False): """ Takes the log format from an Apache configuration file. @@ -209,6 +209,7 @@ class parser: self._names = [] self._regex = None self._pattern = '' + self._use_names = use_names self._parse_format(format) def _parse_format(self, format): @@ -240,7 +241,10 @@ class parser: element = lstripquotes.sub('', element) element = rstripquotes.sub('', element) - self._names.append(self.alias(element)) + if self._use_names: + self._names.append(self.alias(element)) + else: + self._names.append(element) subpattern = '(\S*)'