当前位置: 首页>>代码示例>>Python>>正文


Python Logger.success方法代码示例

本文整理汇总了Python中utils.logger.Logger.success方法的典型用法代码示例。如果您正苦于以下问题:Python Logger.success方法的具体用法?Python Logger.success怎么用?Python Logger.success使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在utils.logger.Logger的用法示例。


在下文中一共展示了Logger.success方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: perform_updates_on_files

# 需要导入模块: from utils.logger import Logger [as 别名]
# 或者: from utils.logger.Logger import success [as 别名]
   def perform_updates_on_files(self,files):
      """
      Given a list of files, dispatch the update and file backup procedures.
      Handles eventual errors raised and logs the process.

      Arguments:
      - files: a list of files to be processed.

      Returns None.
      """
      total = len(files)
      for i, filename in enumerate(files):
         msg = "{}/{} - Processing file {}".format(i, total, filename)
         with Logger.info(msg):
            try:
               self.perform_update(filename)
               self.perform_file_backup(filename)
            except FileUpdateException as e:
               Logger.error(e.msg)
            else:
               Logger.success("File processing complete.")
开发者ID:khamusa,项目名称:spazi-unimi,代码行数:23,代码来源:task.py

示例2: run_command

# 需要导入模块: from utils.logger import Logger [as 别名]
# 或者: from utils.logger.Logger import success [as 别名]
   def run_command(self, command, files):
      """
      Call a command and pass the files we want to process.

      Arguments:
      - command: name of the command we want to run;
      - files: files we want to process.

      Returns: None

      The command name will be used to call the respective routine in the Main
      class. Using the time library to calculate the total time an the mean of
      execution.
      """
      start_time = time.time()

      getattr(self, "run_"+command)(files)

      end_time = time.time() - start_time
      Logger.success("Total time     :", end_time , "seconds")

      if len(files):
         Logger.success("Arithmetic mean:", end_time / len(files), "seconds")
开发者ID:khamusa,项目名称:spazi-unimi,代码行数:25,代码来源:main.py

示例3: perform_update

# 需要导入模块: from utils.logger import Logger [as 别名]
# 或者: from utils.logger.Logger import success [as 别名]
   def perform_update(self):
      Logger.success("Delete old db")
      self._delete_old_db()

      Logger.success("Retrieving building view collection from persistence")
      buildings      = list(BuildingView.get_collection().find({'building_name':{'$exists':True}}))

      Logger.success("Creating new db")
      db_connection = sqlite3.connect( self.db_path() )

      sql_create = "CREATE TABLE lookup("
      sql_create += "id INTEGER PRIMARY KEY,"
      sql_create += "b_id VARCHAR(6),"
      sql_create += "building_name VARCHAR(100),"
      sql_create += "f_id VARCHAR(6),"
      sql_create += "floor_name VARCHAR(20),"
      sql_create += "r_id VARCHAR(10),"
      sql_create += "room_name VARCHAR(100))"
      db_connection.execute(sql_create)

      Logger.success("Begin transaction")

      index = 0
      for building in buildings:
         for f_id,floor in enumerate(building['floors']):
            for room_id in floor['rooms']:
               sql_insert = 'INSERT INTO lookup VALUES({},"{}","{}","{}","{}","{}","{}")'.format(
                  index,
                  building['_id'],
                  building['building_name'],
                  floor['f_id'],
                  floor['floor_name'],
                  room_id,
                  floor['rooms'][room_id]['room_name'])
               db_connection.execute(sql_insert)
               index +=1
      db_connection.commit()
      Logger.success("End transaction")
      Logger.success("{0} entries".format(index))
开发者ID:khamusa,项目名称:spazi-unimi,代码行数:41,代码来源:lookup_table_task.py


注:本文中的utils.logger.Logger.success方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。