From 8cff85963974d17217edfa32fe5de0b1f43f0e54 Mon Sep 17 00:00:00 2001 From: Edward Ribeiro Date: Tue, 23 May 2017 18:18:52 -0300 Subject: [PATCH] Adiciona logging --- sapl/base/search_indexes.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/sapl/base/search_indexes.py b/sapl/base/search_indexes.py index 61fe3438a..394d92e41 100644 --- a/sapl/base/search_indexes.py +++ b/sapl/base/search_indexes.py @@ -1,3 +1,4 @@ +import logging import os.path import textract @@ -9,6 +10,8 @@ from sapl.norma.models import NormaJuridica from textract.exceptions import ExtensionNotSupported +from sapl.settings import BASE_DIR +logger = logging.getLogger(BASE_DIR.name) class DocumentoAcessorioIndex(indexes.SearchIndex, indexes.Indexable): text = indexes.CharField(document=True, use_template=True) @@ -45,7 +48,9 @@ class DocumentoAcessorioIndex(indexes.SearchIndex, indexes.Indexable): except ExtensionNotSupported: return self.prepared_data except Exception: - print('Erro inesperado processando arquivo: %s' % arquivo.path) + msg = 'Erro inesperado processando arquivo: %s' % arquivo.path + print(msg) + logger.error(msg) return self.prepared_data extracted_data = extracted_data.replace('\t', ' ')