68 @staticmethod
69 def setup_warning(k: str):
70 logger.warn(
71 '.env file does not have key {}. Some features may not function as intended.'.format(k))72
73 @staticmethod
74 def setup_error(k: str):
73 @staticmethod
74 def setup_error(k: str):
75 logger.error(
76 '.env file is not correctly set up! Missing key {}'.format(k))77 exit(1)
78
79
Formatting the message manually before passing it to a logging
call does unnecessary work if logging in disabled. Consider using the logging
module's built-in formatting features to avoid that.
import logging, inspect
logging.basicConfig(level=logging.INFO)
logging.debug("Entered function {}".format(inspect.stack[0][3]))
import logging, inspect
logging.basicConfig(level=logging.INFO)
logging.debug("Entered function %s", inspect.stack[0][3])