logs package#
Submodules#
logs.admin module#
logs.apps module#
logs.models module#
- class logs.models.Log(id, event_date, user, user_object, severity, source, sub_source, message, ip)[source]#
Bases:
Model
- exception DoesNotExist#
Bases:
ObjectDoesNotExist
- exception MultipleObjectsReturned#
Bases:
MultipleObjectsReturned
- class SeverityCodes(*values)[source]#
Bases:
TextChoices
- CRITICAL = 'CRITICAL'#
- DEBUG = 'DEBUG'#
- ERROR = 'ERROR'#
- HIGH = 'HIGH'#
- INFO = 'INFO'#
- WARN = 'WARN'#
- event_date#
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
- get_next_by_event_date(*, field=<django.db.models.fields.DateTimeField: event_date>, is_next=True, **kwargs)#
- get_previous_by_event_date(*, field=<django.db.models.fields.DateTimeField: event_date>, is_next=False, **kwargs)#
- get_severity_display(*, field=<django.db.models.fields.CharField: severity>)#
- id#
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
- ip#
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
- message#
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
- objects = <django.db.models.manager.Manager object>#
- severity#
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
- source#
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
- sub_source#
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
- user#
User is a text field to put the name of the user. Sometimes we don’t have a user for an event
- user_object#
User object will be a real user object if we have one
- user_object_id#
logs.urls module#
logs.views module#
- logs.views.log_event(user, severity, source, sub_source, message, request=None)[source]#
Event Logging. Main function.
Note: user parameter can be string or a User object
- Parameters:
user (User or str) – who was involved
severity – how bad
source – where did it come from
sub_source – next level where did it come from
message – text
request
Logging needs to be very defensive, we don’t want logging to cause an outage (happened once already)