A log file that is rotated daily (at or after midnight localtime)

Method shouldRotate Rotate when the date has changed since last write
Method toDate Convert a unixtime to (year, month, day) localtime tuple, or return the current (year, month, day) localtime tuple.
Method suffix Return the suffix given a (year, month, day) tuple or unixtime
Method getLog Given a unix time, return a LogReader for an old log file.
Method write Write some data to the log file
Method rotate Rotate the file and create a new one.
Method __getstate__ Undocumented
Method _openFile Open the log file.

Inherited from BaseLogFile:

Method __init__ Create a log file.
Class Method fromFullPath Construct a log file from a full file path.
Method __setstate__ Undocumented
Method flush Flush the file.
Method close Close the file.
Method reopen Reopen the log file. This is mainly useful if you use an external log rotation tool, which moves under your feet.
Method getCurrentLog Return a LogReader for the current log file.
def _openFile(self): (source)

Open the log file.

We don't open files in binary mode since:

  • an encoding would have to be chosen and that would have to be configurable
  • Twisted doesn't actually support logging non-ASCII messages (see https://twistedmatrix.com/trac/ticket/989)
  • logging plain ASCII messages is fine with any non-binary mode.

See https://twistedmatrix.com/pipermail/twisted-python/2013-October/027651.html for more information.

def shouldRotate(self): (source)

Rotate when the date has changed since last write

def toDate(self, *args): (source)

Convert a unixtime to (year, month, day) localtime tuple, or return the current (year, month, day) localtime tuple.

This function primarily exists so you may overload it with gmtime, or some cruft to make unit testing possible.

def suffix(self, tupledate): (source)

Return the suffix given a (year, month, day) tuple or unixtime

def getLog(self, identifier): (source)

Given a unix time, return a LogReader for an old log file.

def write(self, data): (source)

Write some data to the log file

def rotate(self): (source)

Rotate the file and create a new one.

If it's not possible to open new logfile, this will fail silently, and continue logging to old logfile.

def __getstate__(self): (source)
API Documentation for Twisted, generated by pydoctor at 2016-09-15 00:53:01.