Skip to main content

Django model with log

Project description

KF Django Model with Log

Model with log for django


With requirements.txt

Add the following line in your requirements.txt file:


With PIP

$ pip install modelwithlog

Getting Started

Allow to create a model with log, adding a log field to the model. This create a log message with the formated datetime and a message

Format example:
[2019-03-15 03:00:02] My message

Only must define logger in your model

For example:

import logging

logger = logging.getLogger(__name__)

class MyModel(ModelWithLog):

    logger = logger

    class Meta:
        verbose_name = _('MyModel')
        verbose_name_plural = _('MyModels')

    my_field = models.<Tipe>

Also, this model allows to define the logger level for that log. This are the differents levels loggers


Set log level to Info


Set log level to debug


Set log level to warning


Set log level to error


Set log level to critical

How to use it

Only call your level error with yo message error

For example:"MY ERROR")

Project details

Release history Release notifications | RSS feed

This version


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Files for modelwithlog, version 0.1
Filename, size File type Python version Upload date Hashes
Filename, size modelwithlog-0.1.tar.gz (2.2 kB) File type Source Python version None Upload date Hashes View

Supported by

AWS AWS Cloud computing Datadog Datadog Monitoring DigiCert DigiCert EV certificate Facebook / Instagram Facebook / Instagram PSF Sponsor Fastly Fastly CDN Google Google Object Storage and Download Analytics Pingdom Pingdom Monitoring Salesforce Salesforce PSF Sponsor Sentry Sentry Error logging StatusPage StatusPage Status page