Logo Search packages:      
Sourcecode: scanerrlog version File versions  Download package

def scanerrlog::ApacheErrorLog::__init__ (   self,
  file = None,
  pattern = SEL_DEFAULTPATTERN,
  limit = SEL_DEFAULTLIMIT,
  withdate = SEL_DEFAULTWITHDATE,
  exclude = SEL_DEFAULTEXCLUDE,
  continued = SEL_DEFAULTCONTINUED 
)

If file is not None, then it is automatically opened, read and closed.
If you don't pass a file argument then you'll have to manually open, read and close your own file.
file can be: None, a python file object, a filename, or "-" for sys.stdin

pattern is a regular expression, its default value allows to select all of
Apache "normal" error_log messages, but you can specify your own selection pattern.

limit is an integer or string of digits representing an integer. It allows people
to decide to exclude messages which number of occurences is less than limit
from the final report.

withdate is a flag. If set then the latest message apparitions dates will be included
in the final report.

exclude is string representing a slash separated list of messages severity to exclude from
the final report, e.g.: notice/info/debug will exclude all messages which severity is
notice or info or debug.

continued is a flag telling if statistics have to be saved for further reuse and/or have to
be reused.

Definition at line 729 of file scanerrlog.py.

00729                                                                                                                                                                                                 :
                """If file is not None, then it is automatically opened, read and closed.
If you don't pass a file argument then you'll have to manually open, read and close your own file.
file can be: None, a python file object, a filename, or "-" for sys.stdin

pattern is a regular expression, its default value allows to select all of
Apache "normal" error_log messages, but you can specify your own selection pattern.

limit is an integer or string of digits representing an integer. It allows people
to decide to exclude messages which number of occurences is less than limit
from the final report.

withdate is a flag. If set then the latest message apparitions dates will be included
in the final report.

exclude is string representing a slash separated list of messages severity to exclude from
the final report, e.g.: notice/info/debug will exclude all messages which severity is
notice or info or debug.

continued is a flag telling if statistics have to be saved for further reuse and/or have to
be reused.
"""             
                self.__continued = continued
                self.__erreurs = {}
                self._linestotal = 0
                self._unwanted = 0
                self._underlimit = 0
                self.__infile = None
                self.__opened = 0
                self.__read = 0
                self.__pattern = re.compile(pattern)
                self._withdate = withdate
                self.__exclude = map(string.strip, string.split(exclude, '/'))
                if withdate :
                        if pattern != SEL_DEFAULTPATTERN :
                                self.__stderrmessage(["ScanErrLog: user defined regexp and dates inclusion are mutually exclusive options.\n", \
                                                      "Your regexp will be used but no date will be included in the final report.\n"])
                                self._withdate = 0
                        elif not hasattr(time, "strptime") :
                                self.__stderrmessage(["ScanErrLog: it seems either your Python distribution or your standard C library doesn't support the strptime() function.\n", \
                                                      "No date will be included in the final report.\n"])
                                self._withdate = 0

                try :
                        self._limit = int(limit)
                except (ValueError, OverflowError) :
                        self.__stderrmessage(["ScanErrLog: incorrect limit [%s] argument, defaulting to %i.\n" % (repr(limit), SEL_DEFAULTLIMIT)])
                        self._limit = SEL_DEFAULTLIMIT

                if file != None :
                        self.open(file)
                        self.read()
                        self.close()

        def __repr__(self) :


Generated by  Doxygen 1.6.0   Back to index