Skip to main content

KF Django Model with Log

Model with log for django

Installation

With requirements.txt

Add the following line in your requirements.txt file:

modelwithlog

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

INFO

Set log level to Info

DEBUG

Set log level to debug

WARNING

Set log level to warning

ERROR

Set log level to error

CRITICAL

Set log level to critical

How to use it

Only call your level error with yo message error

For example:
mymodel.info("MY ERROR")

Metadata

Release files for modelwithlog 0.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for modelwithlog 0.1
File Size Uploaded Provenance
modelwithlog-0.1.tar.gz 2.2 kB Without provenance Details

Release files / modelwithlog-0.1.tar.gz

Download URL modelwithlog-0.1.tar.gz
Size 2.2 kB
Tags Source
SHA-256 checksum
How to use checksums
8fa835fe25e52fe4044d39a38fd12a005087ef1cf0f8734053e12001434a7d9b
BLAKE2b-256 checksum
How to use checksums
25f0d894835b2bc0505b7357e9da636afb401e270cf01e279c476dbc2b4a3445
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.1.1 pkginfo/1.5.0.1 requests/2.23.0 setuptools/45.2.0 requests-toolbelt/0.9.1 tqdm/4.43.0 CPython/3.7.6

Security for modelwithlog 0.1

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

0.1 This release

1 release file No provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page