Threadsafe buffer for storing and periodically flushing app logs.
def google.appengine.api.logservice.logservice.LogsBuffer.__init__ |
( |
|
self, |
|
|
|
stream = None , |
|
|
|
stderr = False |
|
) |
| |
Initializes the buffer, which wraps the given stream or sys.stderr.
The state of the LogsBuffer is protected by a separate lock. The lock is
acquired before any variables are mutated or accessed, and released
afterward. A recursive lock is used so that a single thread can acquire the
lock multiple times, and release it only when an identical number of
'unlock()' calls have been performed.
Args:
stream: A file-like object to store logs. Defaults to a cStringIO object.
stderr: If specified, use sys.stderr as the underlying stream.
def google.appengine.api.logservice.logservice.LogsBuffer.age |
( |
|
self | ) |
|
Returns the number of seconds since the log buffer was flushed.
def google.appengine.api.logservice.logservice.LogsBuffer.autoflush |
( |
|
self | ) |
|
Flushes the buffer if certain conditions have been met.
def google.appengine.api.logservice.logservice.LogsBuffer.autoflush_enabled |
( |
|
self | ) |
|
Indicates if the buffer will periodically flush logs during a request.
def google.appengine.api.logservice.logservice.LogsBuffer.bytes |
( |
|
self | ) |
|
Returns the size of the log buffer, in bytes.
def google.appengine.api.logservice.logservice.LogsBuffer.clear |
( |
|
self | ) |
|
Clears the contents of the logs buffer, and resets autoflush state.
def google.appengine.api.logservice.logservice.LogsBuffer.close |
( |
|
self | ) |
|
Closes the underlying stream, flushing the current contents.
def google.appengine.api.logservice.logservice.LogsBuffer.contents |
( |
|
self | ) |
|
Returns the contents of the logs buffer.
def google.appengine.api.logservice.logservice.LogsBuffer.flush |
( |
|
self | ) |
|
Flushes the contents of the logs buffer.
This method holds the buffer lock until the API call has finished to ensure
that flush calls are performed in the correct order, so that log messages
written during the flush call aren't dropped or accidentally wiped, and so
that the other buffer state variables (flush time, lines, bytes) are updated
synchronously with the flush.
def google.appengine.api.logservice.logservice.LogsBuffer.flush_time |
( |
|
self | ) |
|
Returns last time that the log buffer was flushed.
def google.appengine.api.logservice.logservice.LogsBuffer.lines |
( |
|
self | ) |
|
Returns the number of log lines currently buffered.
def google.appengine.api.logservice.logservice.LogsBuffer.parse_logs |
( |
|
self | ) |
|
Parse the contents of the buffer and return an array of log lines.
def google.appengine.api.logservice.logservice.LogsBuffer.reset |
( |
|
self | ) |
|
Resets the buffer state, without clearing the underlying stream.
def google.appengine.api.logservice.logservice.LogsBuffer.stream |
( |
|
self | ) |
|
Returns the underlying file-like object used to buffer logs.
def google.appengine.api.logservice.logservice.LogsBuffer.write |
( |
|
self, |
|
|
|
line |
|
) |
| |
Writes a line to the logs buffer.
def google.appengine.api.logservice.logservice.LogsBuffer.writelines |
( |
|
self, |
|
|
|
seq |
|
) |
| |
Writes each line in the given sequence to the logs buffer.
The documentation for this class was generated from the following file:
- code/googleappengine-read-only/python/google/appengine/api/logservice/logservice.py