我们从Python开源项目中,提取了以下1个代码示例,用于说明如何使用kivy.logger()。
def setup_logger(app_name): '''Setup the analyzer logger. NOTE: All analyzers share the same logger. :param level: the loggoing level. The default value is logging.INFO. ''' level = logging.INFO config = ConfigParser() config.read('/sdcard/.mobileinsight.ini') if config.has_option('mi_general', 'log_level'): level_config = config.get('mi_general', 'log_level') if level_config == "info": level = logging.INFO elif level_config == "debug": level = logging.DEBUG elif level_config == "warning": level = logging.WARNING elif level_config == "error": level = logging.ERROR elif level_config == "critical": level = logging.CRITICAL l = logging.getLogger("mobileinsight_logger") if len(l.handlers) < 1: # formatter = MyFormatter( # '%(asctime)s %(message)s', # datefmt='%Y-%m-%d,%H:%M:%S.%f') formatter = MyFormatter('%(message)s') streamHandler = logging.StreamHandler() streamHandler.setFormatter(formatter) l.setLevel(level) l.addHandler(streamHandler) l.propagate = False log_file = os.path.join( mi2app_utils.get_mobileinsight_analysis_path(), app_name + "_log.txt") Logger.info('service: mi log file: ' + log_file) fileHandler = logging.FileHandler(log_file, mode='w') fileHandler.setFormatter(formatter) l.addHandler(fileHandler) l.disabled = False