Skip to content

Commit 6a83fed

Browse files
authored
Changed logging messages to debug (#60)
* Changed logging messages to debug * Added pylint validation to travis
1 parent 10dd721 commit 6a83fed

File tree

5 files changed

+18
-17
lines changed

5 files changed

+18
-17
lines changed

pylintrc

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ confidence=
5454
# --enable=similarities". If you want to run only the classes checker, but have
5555
# no Warning level messages displayed, use"--disable=all --enable=classes
5656
# --disable=W"
57-
disable=C0301,C0111,C0103,logging-format-interpolation
57+
disable=C0301,C0111,C0103,logging-format-interpolation,broad-except,unnecessary-pass
5858

5959
# Enable the message, report, category or checker with the given id(s). You can
6060
# either give multiple identifier separated by comma (,) or put this option
@@ -362,7 +362,7 @@ dummy-variables-rgx=_+$|(_[a-zA-Z0-9_]*[a-zA-Z0-9]+?$)|dummy|^ignored_|^unused_
362362

363363
# Argument names that match this expression will be ignored. Default to name
364364
# with leading underscore
365-
ignored-argument-names=_.*|^ignored_|^unused_
365+
ignored-argument-names=arg|args|kwargs|_.*|^ignored_|^unused_
366366

367367
# Tells whether we should check for unused import in __init__ files.
368368
init-import=no

pyms/config/confile.py

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,8 @@ def normalize_config(self, config):
4545
item = ConfFile(config=item, empty_init=self.empty_init)
4646
yield self.normalize_keys(key), item
4747

48-
def normalize_keys(self, key):
48+
@staticmethod
49+
def normalize_keys(key):
4950
"""The keys will be transformed to a attribute. We need to replace the charactes not valid"""
5051
key = key.replace("-", "_")
5152
return key
@@ -65,18 +66,18 @@ def __getattr__(self, name, *args, **kwargs):
6566
except KeyError:
6667
if self.empty_init:
6768
return ConfFile(config={}, empty_init=self.empty_init)
68-
else:
69-
raise AttrDoesNotExistException("Variable {} not exist in the config file".format(name))
69+
raise AttrDoesNotExistException("Variable {} not exist in the config file".format(name))
7070

7171
def _get_conf_from_env(self):
7272
config_file = os.environ.get(CONFIGMAP_FILE_ENVIRONMENT, self.default_file)
73-
logger.info("[CONF] Searching file in ENV[{}]: {}...".format(CONFIGMAP_FILE_ENVIRONMENT, config_file))
73+
logger.debug("[CONF] Searching file in ENV[{}]: {}...".format(CONFIGMAP_FILE_ENVIRONMENT, config_file))
7474
return self._get_conf_from_file(config_file)
7575

76-
def _get_conf_from_file(self, path: Text) -> dict:
76+
@staticmethod
77+
def _get_conf_from_file(path: Text) -> dict:
7778
if not path or not os.path.isfile(path):
7879
return {}
79-
logger.info("[CONF] Configmap {} found".format(path))
80+
logger.debug("[CONF] Configmap {} found".format(path))
8081
conf = anyconfig.load(path)
8182
return conf
8283

pyms/flask/services/driver.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,5 +32,5 @@ def get_services(self):
3232

3333
def get_service(self, service, *args, **kwargs):
3434
service_object = import_from("pyms.flask.services.{}".format(service), "Service")
35-
logger.info("Init service {}".format(service))
35+
logger.debug("Init service {}".format(service))
3636
return service_object(service=self.service, *args, **kwargs)

pyms/flask/services/requests.py

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -156,7 +156,7 @@ def get(self, url, path_params=None, params=None, headers=None, propagate_header
156156

157157
full_url = self._build_url(url, path_params)
158158
headers = self._get_headers(headers=headers, propagate_headers=propagate_headers)
159-
logger.info("Get with url {}, params {}, headers {}, kwargs {}".
159+
logger.debug("Get with url {}, params {}, headers {}, kwargs {}".
160160
format(full_url, params, headers, kwargs))
161161

162162
session = requests.Session()
@@ -197,12 +197,12 @@ def post(self, url, path_params=None, data=None, json=None, headers=None, **kwar
197197

198198
full_url = self._build_url(url, path_params)
199199
headers = self._get_headers(headers)
200-
logger.info("Post with url {}, data {}, json {}, headers {}, kwargs {}".format(full_url, data, json,
200+
logger.debug("Post with url {}, data {}, json {}, headers {}, kwargs {}".format(full_url, data, json,
201201
headers, kwargs))
202202

203203
session = requests.Session()
204204
response = self.requests(session=session).post(full_url, data=data, json=json, headers=headers, **kwargs)
205-
logger.info("Response {}".format(response))
205+
logger.debug("Response {}".format(response))
206206

207207
return response
208208

@@ -240,12 +240,12 @@ def put(self, url, path_params=None, data=None, headers=None, **kwargs):
240240

241241
full_url = self._build_url(url, path_params)
242242
headers = self._get_headers(headers)
243-
logger.info("Put with url {}, data {}, headers {}, kwargs {}".format(full_url, data, headers,
243+
logger.debug("Put with url {}, data {}, headers {}, kwargs {}".format(full_url, data, headers,
244244
kwargs))
245245

246246
session = requests.Session()
247247
response = self.requests(session=session).put(full_url, data, headers=headers, **kwargs)
248-
logger.info("Response {}".format(response))
248+
logger.debug("Response {}".format(response))
249249

250250
return response
251251

@@ -280,10 +280,10 @@ def delete(self, url, path_params=None, headers=None, **kwargs):
280280

281281
full_url = self._build_url(url, path_params)
282282
headers = self._get_headers(headers)
283-
logger.info("Delete with url {}, headers {}, kwargs {}".format(full_url, headers, kwargs))
283+
logger.debug("Delete with url {}, headers {}, kwargs {}".format(full_url, headers, kwargs))
284284

285285
session = requests.Session()
286286
response = self.requests(session=session).delete(full_url, headers=headers, **kwargs)
287-
logger.info("Response {}".format(response))
287+
logger.debug("Response {}".format(response))
288288

289289
return response

tox.ini

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ basepython = python3.6
2222
commands = safety check -r requirements-tests.txt
2323
[testenv:pylint]
2424
basepython = python3.6
25-
commands = pylint --rcfile={toxinidir}/pylintrc {toxinidir}/pyms --exit-zero
25+
commands = pylint --rcfile={toxinidir}/pylintrc {toxinidir}/pyms
2626
[testenv:docs]
2727
basepython = python3.6
2828
skipsdist = True

0 commit comments

Comments
 (0)