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

@ -97,14 +97,15 @@ Limitations:
depending on how many nodes you have.
"""
from core import logger
import logging
from core.service import CoreService
from core.service import ServiceManager
try:
from docker import Client
except ImportError:
logger.debug("missing python docker bindings")
logging.debug("missing python docker bindings")
class DockerService(CoreService):
@ -154,7 +155,7 @@ done
@classmethod
def on_load(cls):
logger.debug("loading custom docker services")
logging.debug("loading custom docker services")
if "Client" in globals():
client = Client(version="1.10")

View file

@ -3,8 +3,9 @@ security.py: defines security services (vpnclient, vpnserver, ipsec and
firewall)
"""
import logging
from core import constants
from core import logger
from core.service import CoreService
@ -29,7 +30,7 @@ class VPNClient(CoreService):
try:
cfg += open(fname, "rb").read()
except IOError:
logger.exception("Error opening VPN client configuration template (%s)", fname)
logging.exception("Error opening VPN client configuration template (%s)", fname)
return cfg
@ -56,7 +57,7 @@ class VPNServer(CoreService):
try:
cfg += open(fname, "rb").read()
except IOError:
logger.exception("Error opening VPN server configuration template (%s)", fname)
logging.exception("Error opening VPN server configuration template (%s)", fname)
return cfg
@ -83,7 +84,7 @@ class IPsec(CoreService):
try:
cfg += open(fname, "rb").read()
except IOError:
logger.exception("Error opening IPsec configuration template (%s)", fname)
logging.exception("Error opening IPsec configuration template (%s)", fname)
return cfg
@ -107,7 +108,7 @@ class Firewall(CoreService):
try:
cfg += open(fname, "rb").read()
except IOError:
logger.exception("Error opening Firewall configuration template (%s)", fname)
logging.exception("Error opening Firewall configuration template (%s)", fname)
return cfg

View file

@ -2,7 +2,8 @@
xorp.py: defines routing services provided by the XORP routing suite.
"""
from core import logger
import logging
from core.service import CoreService
@ -42,7 +43,7 @@ class XorpRtrmgr(CoreService):
s.dependencies.index(cls.name)
cfg += s.generatexorpconfig(node)
except ValueError:
logger.exception("error getting value from service: %s", cls.name)
logging.exception("error getting value from service: %s", cls.name)
return cfg