From 47eba63f4802056ac16a970038b836a8d3431c8a Mon Sep 17 00:00:00 2001 From: Roberto Rosario Date: Sun, 23 Aug 2015 22:37:35 -0400 Subject: [PATCH] Add audit logging to document comment model. --- mayan/apps/document_comments/models.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/mayan/apps/document_comments/models.py b/mayan/apps/document_comments/models.py index 9fc6ca74b8..f977077dae 100644 --- a/mayan/apps/document_comments/models.py +++ b/mayan/apps/document_comments/models.py @@ -1,5 +1,7 @@ from __future__ import unicode_literals +import logging + from django.conf import settings from django.db import models from django.utils.encoding import python_2_unicode_compatible @@ -9,6 +11,8 @@ from documents.models import Document from .events import event_document_comment_create, event_document_comment_delete +logger = logging.getLogger(__name__) + @python_2_unicode_compatible class Comment(models.Model): @@ -39,8 +43,10 @@ class Comment(models.Model): event_document_comment_create.commit( actor=user, target=self.document ) + logger.info('Comment "%s" added to document "%s" by user "%s"', self.comment, self.document, user) else: event_document_comment_create.commit(target=self.document) + logger.info('Comment "%s" added to document "%s"', self.comment, self.document) def delete(self, *args, **kwargs): user = kwargs.pop('_user', None)