diff options
author | Steve McIntyre <steve.mcintyre@linaro.org> | 2015-09-23 00:04:55 +0100 |
---|---|---|
committer | Steve McIntyre <steve.mcintyre@linaro.org> | 2015-09-23 00:04:55 +0100 |
commit | 26de4d917ca3ca3d549324f3e735545995e1f460 (patch) | |
tree | b7d68038b83e7d85bb85945f33bb64846be6b7b2 /util.py | |
parent | e3fb49ae0b2168d36ff3607158365c42a7c0ed4f (diff) |
Move common loglevel code into a new utility function set_logging_level()
Change-Id: I436319311192cc4ee8b29935b3acb69e0ba613e1
Diffstat (limited to 'util.py')
-rw-r--r-- | util.py | 17 |
1 files changed, 17 insertions, 0 deletions
@@ -5,6 +5,23 @@ from errors import CriticalError, InputError, ConfigError, SocketError class VlanUtil: """VLANd utility functions""" + def set_logging_level(self, level): + + # Set up logging and maybe go quiet... + if level is None: + level = "CRITICAL" + + loglevel = logging.CRITICAL + if level == "ERROR": + loglevel = logging.ERROR + elif level == "WARNING": + loglevel = logging.WARNING + elif level == "INFO": + loglevel = logging.INFO + elif level == "DEBUG": + loglevel = logging.DEBUG + return loglevel + def get_switch_driver(self, switch_name, config): logging.debug("Trying to find a driver for %s", switch_name) driver = config.switches[switch_name].driver |