Skip to content

Commit f700ab5

Browse files
stevenvdbkorydraughn
authored andcommitted
[#771] Use named loggers instead of directly calling logging
1 parent 76ce0e6 commit f700ab5

File tree

3 files changed

+11
-5
lines changed

3 files changed

+11
-5
lines changed

irods/auth/__init__.py

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,9 @@
1717
_NoneType = type(None)
1818

1919

20+
_logger = logging.getLogger(__name__)
21+
22+
2023
class AuthStorage:
2124
"""A class that facilitates flexible means of password storage.
2225
@@ -166,7 +169,7 @@ def __init__(self, connection, scheme):
166169
self.scheme = scheme
167170

168171
def call(self, next_operation, request):
169-
logging.debug("next operation = %r", next_operation)
172+
_logger.debug("next operation = %r", next_operation)
170173
old_func = func = next_operation
171174
# One level of indirection should be sufficient to get a callable method.
172175
if not callable(func):
@@ -175,7 +178,7 @@ def call(self, next_operation, request):
175178
if not callable(func):
176179
raise RuntimeError("client request contains no callable 'next_operation'")
177180
resp = func(request)
178-
logging.debug("resp = %r", resp)
181+
_logger.debug("resp = %r", resp)
179182
return resp
180183

181184
def authenticate_client(
@@ -202,4 +205,4 @@ def authenticate_client(
202205
)
203206
to_send = resp
204207

205-
logging.debug("fully authenticated")
208+
_logger.debug("fully authenticated")

irods/manager/data_object_manager.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -404,7 +404,7 @@ def chksum(self, path, **options):
404404
# We'll get a response in the client to help qualify or elaborate on the error thrown.
405405
if msg_retn:
406406
response = msg_retn[0]
407-
logging.warning("Exception checksumming data object %r - %r", path, exc)
407+
logger.warning("Exception checksumming data object %r - %r", path, exc)
408408
if "response" in locals():
409409
try:
410410
results = response.get_main_message(

irods/path/__init__.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,9 @@
77
import os
88

99

10+
_logger = logging.getLogger(__name__)
11+
12+
1013
class iRODSPath(str):
1114
"""A subclass of the Python string that normalizes iRODS logical paths."""
1215

@@ -49,7 +52,7 @@ def __new__(cls, *elem_list, **kw):
4952
"""
5053
absolute_ = kw.pop("absolute", True)
5154
if kw:
52-
logging.warning("These iRODSPath options have no effect: %r", kw.items())
55+
_logger.warning("These iRODSPath options have no effect: %r", kw.items())
5356
normalized = _normalize_iRODS_logical_path(elem_list, absolute_)
5457
obj = str.__new__(cls, normalized)
5558
return obj

0 commit comments

Comments
 (0)