diff options
Diffstat (limited to 'config_binding_service/__init__.py')
-rw-r--r-- | config_binding_service/__init__.py | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/config_binding_service/__init__.py b/config_binding_service/__init__.py index 5f09f1e..2835511 100644 --- a/config_binding_service/__init__.py +++ b/config_binding_service/__init__.py @@ -19,7 +19,7 @@ import os import logging -'''Configures the module root logger''' +# Configures the module root logger root = logging.getLogger() if root.handlers: root.handlers.clear() @@ -29,13 +29,19 @@ handler.setFormatter(formatter) root.addHandler(handler) root.setLevel("DEBUG") + class BadEnviornmentENVNotFound(Exception): + """ + Specific exception to be raised when a required ENV varaible is missing + """ pass + def get_logger(module=None): '''Returns a module-specific logger or global logger if the module is None''' return root if module is None else root.getChild(module) + def get_consul_uri(): """ This method waterfalls reads an envioronmental variable called CONSUL_HOST @@ -48,5 +54,3 @@ def get_consul_uri(): return "http://{0}:{1}".format(os.environ["CONSUL_HOST"], 8500) else: raise BadEnviornmentENVNotFound("CONSUL_HOST") - - |