Skip to main content

BaseStorage

This is the base backend for temporary message storage.

This is not a complete class; to be a usable storage backend, it must be subclassed and the two methods _get and _store overridden.

Attributes

AttributeTypeDescription
levelintegerThe minimum recorded level for messages, where messages with a level lower than this value are ignored.

Constructor

Signature

def BaseStorage(
request: object,
*args: any,
**kwargs: any
) - > null

Parameters

NameTypeDescription
requestobjectThe request object associated with the storage.
*argsanyVariable length argument list passed to the parent constructor.
**kwargsanyArbitrary keyword arguments passed to the parent constructor.

Methods


update()

@classmethod
def update(
response: [HttpResponse](../../../../http/response/httpresponse.md?sid=django_http_response_httpresponse)
) - > list

Store all unread messages. If the backend has yet to be iterated, store previously stored messages again. Otherwise, only store messages added after the last iteration.

Parameters

NameTypeDescription
response[HttpResponse](../../../../http/response/httpresponse.md?sid=django_http_response_httpresponse)The response object used to persist the messages

Returns

TypeDescription
listA list of messages that could not be stored

add()

@classmethod
def add(
level: int,
message: str,
extra_tags: str = ""
) - > null

Queue a message to be stored. The message is only queued if it contained something and its level is not less than the recording level (self.level).

Parameters

NameTypeDescription
levelintThe severity level of the message (e.g., DEBUG, INFO, ERROR)
messagestrThe actual content of the message to be stored
extra_tagsstr = ""A string of space-separated tags to provide additional context to the message

Returns

TypeDescription
nullnull