cmdopts, cmdargs = parser.parse_args() silent = cmdopts.silent debug = cmdopts.debug config_exists = alexapi.config.filename is not None if config_exists: with open(alexapi.config.filename, 'r') as stream: config = yaml.load(stream) if debug: log_level = logging.DEBUG else: if config_exists: log_level = logging.getLevelName(config.get('logging', 'INFO').upper()) else: log_level = logging.getLevelName('INFO') if cmdopts.daemon: coloredlogs.DEFAULT_LOG_FORMAT = '%(levelname)s: %(message)s' else: coloredlogs.DEFAULT_LOG_FORMAT = '%(asctime)s %(levelname)s: %(message)s' coloredlogs.install(level=log_level) alexa_logger = logging.getLogger('alexapi') alexa_logger.setLevel(log_level) logger = logging.getLogger(__name__) if not config_exists: