Package buildbot :: Package status :: Module logfile :: Class LogFile
[frames] | no frames]

Class LogFile

source code

A LogFile keeps all of its contents on disk, in a non-pickle format to which new entries can easily be appended. The file on disk has a name like 12-log-compile-output, under the Builder's directory. The actual filename is generated (before the LogFile is created) by BuildStatus.generateLogfileName.

Instance Methods
 
__init__(self, parent, name, logfilename) source code
 
getFilename(self)
Get the base (uncompressed) filename for this log file.
source code
 
hasContents(self)
Return true if this logfile's contents are available.
source code
 
getName(self)
Get this logfile's name
source code
 
getStep(self)
Get the BuildStepStatus instance containing this logfile
source code
 
isFinished(self)
Return true if this logfile is finished (that is, if it will not receive any additional data
source code
 
waitUntilFinished(self)
Return a Deferred that will fire when this logfile is finished, or will fire immediately if the logfile is already finished.
source code
 
getFile(self)
Get an open file object for this log.
source code
 
getText(self) source code
 
getTextWithHeaders(self) source code
 
getChunks(self, channels=[], onlyText=False) source code
 
readlines(self, channel=0)
Return an iterator that produces newline-terminated lines, excluding header chunks.
source code
 
subscribe(self, receiver, catchup) source code
 
unsubscribe(self, receiver) source code
 
subscribeConsumer(self, consumer) source code
 
addEntry(self, channel, text, _no_watchers=False)
Add an entry to the logfile.
source code
 
addStdout(self, text)
Shortcut to add stdout text to the logfile
source code
 
addStderr(self, text)
Shortcut to add stderr text to the logfile
source code
 
addHeader(self, text)
Shortcut to add header text to the logfile
source code
 
finish(self)
Finish the logfile, flushing any buffers and preventing any further writes to the log.
source code
 
compressLog(self) source code
 
__getstate__(self) source code
 
__setstate__(self, d) source code
 
__providedBy__(...)
Object Specification Descriptor
source code
 
__provides__(...)
Special descriptor for class __provides__
Class Variables
  finished = False
  nonHeaderLength = 0
  tailLength = 0
  chunkSize = 10000
  runLength = 0
  logMaxTailSize = None
hash(x)
  maxLengthExceeded = False
  runEntries = []
  entries = None
hash(x)
  BUFFERSIZE = 2048
  filename = None
hash(x)
  openfile = None
hash(x)
  __implemented__ = <implementedBy buildbot.status.logfile.LogFile>
Instance Variables
  length = 0
length of the data in the logfile (sum of chunk sizes; not the length of the on-disk encoding)
Method Details

__init__(self, parent, name, logfilename)
(Constructor)

source code 
Parameters:
  • parent (BuildStepStatus) - the Step that this log is a part of
  • name (string) - the name of this log, typically 'output'
  • logfilename (string) - the Builder-relative pathname for the saved entries

getFilename(self)

source code 

Get the base (uncompressed) filename for this log file.

Returns:
filename

hasContents(self)

source code 

Return true if this logfile's contents are available. For a newly created logfile, this is always true, but for a LogFile instance that has been persisted, the logfiles themselves may have been deleted, in which case this method will return False.

Returns:
boolean

getName(self)

source code 

Get this logfile's name

Returns:
string

getStep(self)

source code 

Get the BuildStepStatus instance containing this logfile

Returns:
BuildStepStatus instance

isFinished(self)

source code 

Return true if this logfile is finished (that is, if it will not receive any additional data

Returns:
boolean

getFile(self)

source code 

Get an open file object for this log. The file may also be in use for writing, so it should not be closed by the caller, and the caller should not rely on its file position remaining constant between asynchronous code segments.

Returns:
file object

addEntry(self, channel, text, _no_watchers=False)

source code 

Add an entry to the logfile. The channel is one of STDOUT, STDERR, or HEADER. The text is the text to add to the logfile, which can be a unicode string or a bytestring which is presumed to be encoded with utf-8.

This method cannot be called after the logfile is finished.

Parameters:
  • channel - channel to add a chunk for
  • text - chunk of text
  • _no_watchers - private

addStdout(self, text)

source code 

Shortcut to add stdout text to the logfile

Parameters:
  • text - text to add to the logfile

addStderr(self, text)

source code 

Shortcut to add stderr text to the logfile

Parameters:
  • text - text to add to the logfile

addHeader(self, text)

source code 

Shortcut to add header text to the logfile

Parameters:
  • text - text to add to the logfile

__provides__(...)

 
Special descriptor for class __provides__

The descriptor caches the implementedBy info, so that
we can get declarations for objects without instance-specific
interfaces a bit quicker.

For example:

  >>> from zope.interface import Interface
  >>> class IFooFactory(Interface):
  ...     pass
  >>> class IFoo(Interface):
  ...     pass
  >>> class C(object):
  ...     implements(IFoo)
  ...     classProvides(IFooFactory)
  >>> [i.getName() for i in C.__provides__]
  ['IFooFactory']

  >>> [i.getName() for i in C().__provides__]
  ['IFoo']