Loggable

This app allows you to keep a log for each object in your model.

How to use

Define a manager in your model (logs):

from loggable.models import Loggable

class MyModel(...):
    field1 = ...
    field2 = ...

    logs = Loggable()

Now you can write a log using log method:

from loggable.constants import LoggingLevel

my_object = MyModel.objects.first()
my_object.log('This is a new message', LoggingLevel.INFO)

Log levels

The differents logs available are emumerate in LoggingLevel class.

class LoggingLevel(value)[source]

Enum with the different log levels available

CRITICAL = 50

Information describing a fatal problem that has occurred (same as critical).

FATAL = 50

Information describing a major problem that has occurred.

ERROR = 40

Information describing a minor problem that has occurred.

WARNING = 30

Information describing a minor problem that has occurred (same as warning).

WARN = 30

General system information.

INFO = 20

Low level system information for debugging purposes.

DEBUG = 10

No log level.