RollingBuffer

class lib.logger.RollingBuffer

Bases: deque

File-like that keeps a certain number of lines of text in memory for writing out to the crash log.

Attributes Summary

maxlen

maximum size of a deque or None if unbounded

Methods Summary

append(item, /)

Add an element to the right side of the deque.

appendleft(item, /)

Add an element to the left side of the deque.

clear()

Remove all elements from the deque.

copy()

Return a shallow copy of a deque.

count(value, /)

Return number of occurrences of value.

extend(iterable, /)

Extend the right side of the deque with elements from the iterable.

extendleft(iterable, /)

Extend the left side of the deque with elements from the iterable.

index

Return first index of value.

insert(index, value, /)

Insert value before index.

pop()

Remove and return the rightmost element.

popleft()

Remove and return the leftmost element.

remove(value, /)

Remove first occurrence of value.

reverse()

Reverse IN PLACE.

rotate([n])

Rotate the deque n steps to the right.

write(buffer)

Splits lines from the incoming buffer and writes them out to the rolling buffer.

Attributes Documentation

maxlen

maximum size of a deque or None if unbounded

Methods Documentation

append(item, /)

Add an element to the right side of the deque.

appendleft(item, /)

Add an element to the left side of the deque.

clear()

Remove all elements from the deque.

copy()

Return a shallow copy of a deque.

count(value, /)

Return number of occurrences of value.

extend(iterable, /)

Extend the right side of the deque with elements from the iterable.

extendleft(iterable, /)

Extend the left side of the deque with elements from the iterable.

index()

Return first index of value.

Raises ValueError if the value is not present.

insert(index, value, /)

Insert value before index.

pop()

Remove and return the rightmost element.

popleft()

Remove and return the leftmost element.

remove(value, /)

Remove first occurrence of value.

reverse()

Reverse IN PLACE.

rotate(n=1, /)

Rotate the deque n steps to the right. If n is negative, rotates left.

write(buffer: str) None

Splits lines from the incoming buffer and writes them out to the rolling buffer.

Parameters:

buffer (str) – The log messages to write to the rolling buffer

Return type:

None

write(buffer: str) None

Splits lines from the incoming buffer and writes them out to the rolling buffer.

Parameters:

buffer (str) – The log messages to write to the rolling buffer

Return type:

None