From 14118e4b0d7777a93a24b215e5af9061cc2392a0 Mon Sep 17 00:00:00 2001 From: Jack Stdin Date: Mon, 15 Feb 2016 12:16:53 +0300 Subject: [PATCH] Add logging option --- aore/config/common.py | 3 +++ aore/config/dev.py | 2 ++ aore/fias/search.py | 3 --- aore/fias/wordentry.py | 4 +++- 4 files changed, 8 insertions(+), 4 deletions(-) diff --git a/aore/config/common.py b/aore/config/common.py index 9afbcc5..3261db5 100644 --- a/aore/config/common.py +++ b/aore/config/common.py @@ -1,5 +1,8 @@ # -*- coding: utf-8 -*- +class basic: + logging = False + class sphinx_conf: host_name = "localhost" diff --git a/aore/config/dev.py b/aore/config/dev.py index 1e728b3..67ab7f7 100644 --- a/aore/config/dev.py +++ b/aore/config/dev.py @@ -16,3 +16,5 @@ db_conf.password = "intercon" unrar_config.path = "C:\\Program Files (x86)\\WinRAR\\unrar.exe" folders.temp = "E:\\!TEMP" + +basic.logging = True diff --git a/aore/fias/search.py b/aore/fias/search.py index 65750ce..0701626 100644 --- a/aore/fias/search.py +++ b/aore/fias/search.py @@ -116,14 +116,11 @@ class SphinxSearch: word_entries = self.__get_word_entries(words, strong) word_count = len(word_entries) for x in range(word_count, max(0, word_count - 3), -1): - logging.info("\"{}\"/{}".format(" ".join(x.get_variations() for x in word_entries), x)) self.client_show.AddQuery("\"{}\"/{}".format(" ".join(x.get_variations() for x in word_entries), x), sphinx_conf.index_addjobj) self.__configure(sphinx_conf.index_addjobj) - logging.info("QUERY ") rs = self.client_show.RunQueries() - logging.info("OK") results = [] parsed_ids = [] diff --git a/aore/fias/wordentry.py b/aore/fias/wordentry.py index 2e71925..b4c3aa7 100644 --- a/aore/fias/wordentry.py +++ b/aore/fias/wordentry.py @@ -2,6 +2,7 @@ import re from aore.config import sphinx_conf +from aore.config import basic class WordEntry: @@ -106,7 +107,8 @@ class WordEntry: out_mask_list.append('x') else: out_mask_list.append(str(result[i][0])) - + if basic.logging: + print str(self.word) + ''.join(out_mask_list) return ''.join(out_mask_list) def get_type(self):