def METHOD_NAME(log_component = '', log_action = '', log_resource = ''):
	def _log_decorator(view_function):
		def _decorator(request, *args, **kwargs):
			user = None
			#Get user before logout
			if request.user.is_authenticated:
				user = request.user				
			response = view_function(request, *args, **kwargs)
			#Get user after login
			if user is None and request.user.is_authenticated:
				user = request.user
			log_context = {}
			if hasattr(request, 'log_context'):
				log_context = request.log_context
			if user:				
				log = Log()
				log.user = str(user)
				log.user_id = user.id
				log.user_email = user.email
				log.component = log_component
				log.context = log_context
				log.action = log_action
				log.resource = log_resource
				log.save()
				if log.component == 'resources' and not user.is_staff:
					resource = log.context[log.resource + '_id'] if log.resource + '_id' in log.context else 0
					if not resource == 0:
						pendency = Pendencies.objects.filter(action = log.action, resource__id = resource, resource__visible = True).order_by('-id')
						if pendency.exists():
							pendency = pendency.get()
							if ((not pendency.end_date or timezone.now() <= pendency.end_date) or (pendency.limit_date and timezone.now() <= pendency.limit_date) or (not pendency.end_date or (not pendency.limit_date and timezone.now() > pendency.end_date))):
								if actor in pendency.resource.students.all() or (pendency.resource.all_students and actor in pendency.resource.topic.subject.students.all()):
									if not PendencyDone.objects.filter(pendency = pendency, student = actor).exists():
										pendencyDone = PendencyDone()
										pendencyDone.pendency = pendency
										pendencyDone.student = actor
										pendencyDone.done_date = timezone.now()
										if not pendency.begin_date or not pendency.end_date:
											pendencyDone.late = False
										elif pendency.begin_date > timezone.now():
											pendencyDone.late = False
										elif pendency.begin_date <= timezone.now() <= pendency.end_date:
											pendencyDone.late = False
										elif (pendency.limit_date and pendency.end_date < timezone.now() <= pendency.limit_date) or (not pendency.limit_date and pendency.end_date < timezone.now()):
											pendencyDone.late = True
										pendencyDone.save()
			return response
		return wraps(view_function)(_decorator)
	return _log_decorator