Caution
Buildbot no longer supports Python 2.7 on the Buildbot master.
3.10.16. Logs¶
-
class
buildbot.process.log.
Log
¶ This class handles write-only access to log files from running build steps. It does not provide an interface for reading logs - such access should occur directly through the Data API.
Instances of this class can only be created by the
addLog
method of a build step.-
name
¶ The name of the log.
Note that if you have a build step which outputs multiple logs, naming one of the logs
Summary
will cause the Web UI to sort the summary log first in the list, and expand it so that the contents are immediately visible.
-
logid
¶ The ID of the logfile.
-
decoder
¶ A callable used to decode bytestrings. See
logEncoding
.
-
subscribe
(receiver)¶ - Parameters
receiver (callable) – the function to call
Register
receiver
to be called with line-delimited chunks of log data. The callable is invoked asreceiver(stream, chunk)
, where the stream is indicated by a single character, or None for logs without streams. The chunk is a single string containing an arbitrary number of log lines, and terminated with a newline. When the logfile is finished,receiver
will be invoked withNone
for both arguments.The callable cannot return a Deferred. If it must perform some asynchronous operation, it will need to handle its own Deferreds, and be aware that multiple overlapping calls may occur.
Note that no “rewinding” takes place: only log content added after the call to
subscribe
will be supplied toreceiver
.
-
finish
()¶ - Returns
Deferred
This method indicates that the logfile is finished. No further additions will be permitted.
-
In use, callers will receive a subclass with methods appropriate for the log type:
-
class
buildbot.process.log.
TextLog
¶ -
addContent(text):
- Parameters
text – log content
- Returns
Deferred
Add the given data to the log. The data need not end on a newline boundary.
-
-
class
buildbot.process.log.
HTMLLog
¶ -
addContent(text):
- Parameters
text – log content
- Returns
Deferred
Same as
TextLog.addContent
.
-
-
class
buildbot.process.log.
StreamLog
¶ This class handles logs containing three interleaved streams: stdout, stderr, and header. The resulting log maintains data distinguishing these streams, so they can be filtered or displayed in different colors. This class is used to represent the stdio log in most steps.
-
addStdout
(text)¶ - Parameters
text – log content
- Returns
Deferred
Add content to the stdout stream. The data need not end on a newline boundary.
-
addStderr
(text)¶ - Parameters
text – log content
- Returns
Deferred
Add content to the stderr stream. The data need not end on a newline boundary.
-
addHeader
(text)¶ - Parameters
text – log content
- Returns
Deferred
Add content to the header stream. The data need not end on a newline boundary.
-