updated logging usage, to use the library directly and avoid imposing a core config by default, allowing users of the core library to configure logging as desired

This commit is contained in:
bharnden 2019-02-16 09:50:19 -08:00
parent 37f747c212
commit 7aee2b2ba7
44 changed files with 552 additions and 527 deletions

View file

@ -2,14 +2,13 @@
Helper objects for dealing with IPv4/v6 addresses.
"""
import logging
import random
import socket
import struct
from socket import AF_INET
from socket import AF_INET6
from core import logger
class MacAddress(object):
"""
@ -151,7 +150,7 @@ class IpAddress(object):
try:
carry = int(other)
except ValueError:
logger.exception("error during addition")
logging.exception("error during addition")
return NotImplemented
tmp = [ord(x) for x in self.addr]
@ -174,7 +173,7 @@ class IpAddress(object):
try:
tmp = -int(other)
except ValueError:
logger.exception("error during subtraction")
logging.exception("error during subtraction")
return NotImplemented
return self.__add__(tmp)
@ -276,7 +275,7 @@ class IpPrefix(object):
try:
tmp = int(other)
except ValueError:
logger.exception("error during addition")
logging.exception("error during addition")
return NotImplemented
a = IpAddress(self.af, self.prefix) + (tmp << (self.addrlen - self.prefixlen))
@ -297,7 +296,7 @@ class IpPrefix(object):
try:
tmp = -int(other)
except ValueError:
logger.exception("error during subtraction")
logging.exception("error during subtraction")
return NotImplemented
return self.__add__(tmp)