Skip to content

Commit cf5ec9b

Browse files
authored
Merge pull request #92 from cunha/lib-logger
Use named loggers
2 parents 9c854f4 + 279eddb commit cf5ec9b

3 files changed

Lines changed: 11 additions & 5 deletions

File tree

ripe/atlas/sagan/base.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,9 @@
2828
import json
2929

3030

31+
log = logging.getLogger(__name__)
32+
33+
3134
class ResultParseError(Exception):
3235
pass
3336

@@ -138,14 +141,14 @@ def _handle_malformation(self, message):
138141
if self._on_malformation == self.ACTION_FAIL:
139142
raise ResultParseError(message)
140143
elif self._on_malformation == self.ACTION_WARN:
141-
logging.warning(message)
144+
log.warning(message)
142145
self.is_malformed = True
143146

144147
def _handle_error(self, message):
145148
if self._on_error == self.ACTION_FAIL:
146149
raise ResultError(message)
147150
elif self._on_error == self.ACTION_WARN:
148-
logging.warning(message)
151+
log.warning(message)
149152
self.is_error = True
150153
self.error_message = message
151154

ripe/atlas/sagan/ssl.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@
2525
from cryptography.hazmat.backends import openssl
2626
from cryptography.hazmat.primitives import hashes
2727
except ImportError:
28-
logging.warning(
28+
logging.getLogger(__name__).warning(
2929
"cryptography module is not installed, without it you cannot parse SSL "
3030
"certificate measurement results"
3131
)

ripe/atlas/sagan/traceroute.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,9 @@
2020
from .base import Result, ParsingDict
2121

2222

23+
log = logging.getLogger(__name__)
24+
25+
2326
class IcmpHeader(ParsingDict):
2427
"""
2528
But why did we stop here? Why not go all the way and define subclasses for
@@ -148,14 +151,14 @@ def __init__(self, data, **kwargs):
148151

149152
@property
150153
def last_rtt(self):
151-
logging.warning(
154+
log.warning(
152155
'"last_rtt" is deprecated and will be removed in future versions. '
153156
'Instead, use "last_median_rtt".')
154157
return self.last_median_rtt
155158

156159
@property
157160
def target_responded(self):
158-
logging.warning(
161+
log.warning(
159162
'The "target_responded" property is deprecated and will be removed '
160163
'in future versions. Instead, use "destination_ip_responded".'
161164
)

0 commit comments

Comments
 (0)