Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use named loggers #92

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 5 additions & 2 deletions ripe/atlas/sagan/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,9 @@
import json


log = logging.getLogger(__name__)


class ResultParseError(Exception):
pass

Expand Down Expand Up @@ -138,14 +141,14 @@ def _handle_malformation(self, message):
if self._on_malformation == self.ACTION_FAIL:
raise ResultParseError(message)
elif self._on_malformation == self.ACTION_WARN:
logging.warning(message)
log.warning(message)
self.is_malformed = True

def _handle_error(self, message):
if self._on_error == self.ACTION_FAIL:
raise ResultError(message)
elif self._on_error == self.ACTION_WARN:
logging.warning(message)
log.warning(message)
self.is_error = True
self.error_message = message

Expand Down
2 changes: 1 addition & 1 deletion ripe/atlas/sagan/ssl.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
from cryptography.hazmat.backends import openssl
from cryptography.hazmat.primitives import hashes
except ImportError:
logging.warning(
logging.getLogger(__name__).warning(
"cryptography module is not installed, without it you cannot parse SSL "
"certificate measurement results"
)
Expand Down
7 changes: 5 additions & 2 deletions ripe/atlas/sagan/traceroute.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,9 @@
from .base import Result, ParsingDict


log = logging.getLogger(__name__)


class IcmpHeader(ParsingDict):
"""
But why did we stop here? Why not go all the way and define subclasses for
Expand Down Expand Up @@ -148,14 +151,14 @@ def __init__(self, data, **kwargs):

@property
def last_rtt(self):
logging.warning(
log.warning(
'"last_rtt" is deprecated and will be removed in future versions. '
'Instead, use "last_median_rtt".')
return self.last_median_rtt

@property
def target_responded(self):
logging.warning(
log.warning(
'The "target_responded" property is deprecated and will be removed '
'in future versions. Instead, use "destination_ip_responded".'
)
Expand Down