set default logging to INFO, cleaned up logging to help isolate debug type messages to DEBUG level, fixed issue with shutdown

This commit is contained in:
Blake J. Harnden 2018-04-27 12:09:31 -07:00
parent ba3669712a
commit 44781d0aec
18 changed files with 114 additions and 114 deletions

View file

@ -2,8 +2,6 @@
Serves as a global point for storing and retrieving node types needed during simulation.
"""
import pprint
from core import logger
_NODE_MAP = None
@ -11,8 +9,11 @@ _NODE_MAP = None
def _log_map():
global _NODE_MAP
print_map = reduce(lambda x, y: _convert_map(x, y), _NODE_MAP.items(), {})
logger.info("node class map: \n%s", pprint.pformat(print_map, indent=4))
for key, value in _NODE_MAP.iteritems():
name = None
if value:
name = value.__name__
logger.info("node type (%s) - class (%s)", key.name, name)
def _convert_map(x, y):

View file

@ -40,7 +40,7 @@ def pack_values(clazz, packers):
value = transformer(value)
# pack and add to existing data
logger.info("packing: %s - %s", tlv_type, value)
logger.debug("packing: %s - %s", tlv_type, value)
data += clazz.pack(tlv_type.value, value)
return data

View file

@ -370,13 +370,13 @@ def load_classes(path, clazz):
:return: list of classes loaded
"""
# validate path exists
logger.info("attempting to load modules from path: %s", path)
logger.debug("attempting to load modules from path: %s", path)
if not os.path.isdir(path):
logger.warn("invalid custom module directory specified" ": %s" % path)
# check if path is in sys.path
parent_path = os.path.dirname(path)
if parent_path not in sys.path:
logger.info("adding parent path to allow imports: %s", parent_path)
logger.debug("adding parent path to allow imports: %s", parent_path)
sys.path.append(parent_path)
# retrieve potential service modules, and filter out invalid modules
@ -389,7 +389,7 @@ def load_classes(path, clazz):
classes = []
for module_name in module_names:
import_statement = "%s.%s" % (base_module, module_name)
logger.info("importing custom module: %s", import_statement)
logger.debug("importing custom module: %s", import_statement)
try:
module = importlib.import_module(import_statement)
members = inspect.getmembers(module, lambda x: _is_class(module, x, clazz))