File: cls-log.rst

package info (click to toggle)
buildbot 4.3.0-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 21,080 kB
  • sloc: python: 174,183; sh: 1,204; makefile: 332; javascript: 119; xml: 16
file content (117 lines) | stat: -rw-r--r-- 3,634 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
Logs
====

.. py:module:: buildbot.process.log

.. py:class:: 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
    :py:meth:`~buildbot.process.buildstep.BuildStep.addLog` method of a build step.

    .. py:attribute:: 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.

    .. py:attribute:: type

        The type of the log, represented as a single character.
        See :bb:rtype:`logchunk` for details.

    .. py:attribute:: logid

        The ID of the logfile.

    .. py:attribute:: decoder

        A callable used to decode bytestrings.
        See :bb:cfg:`logEncoding`.

    .. py:method:: subscribe(receiver)

        :param callable receiver: the function to call

        Register ``receiver`` to be called with line-delimited chunks of log data. The callable is
        invoked as ``receiver(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 with ``None`` 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 to ``receiver``.

    .. py:method:: flush()

        :returns: Deferred

        Flush any pending data to database. All unfinished lines will be terminated with newline
        characters.

    .. py:method:: 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:

.. py:class:: TextLog

    .. py:method:: addContent(text):

        :param text: log content
        :returns: Deferred

        Add the given data to the log.
        The data need not end on a newline boundary.


.. py:class:: HTMLLog

    .. py:method:: addContent(text):

        :param text: log content
        :returns: Deferred

        Same as :py:meth:`TextLog.addContent`.

.. py:class:: 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.

    .. py:method:: addStdout(text)

        :param text: log content
        :returns: Deferred

        Add content to the stdout stream.
        The data need not end on a newline boundary.

    .. py:method:: addStderr(text)

        :param text: log content
        :returns: Deferred

        Add content to the stderr stream.
        The data need not end on a newline boundary.

    .. py:method:: addHeader(text)

        :param text: log content
        :returns: Deferred

        Add content to the header stream.
        The data need not end on a newline boundary.