當前位置: 首頁>>代碼示例>>Python>>正文


Python sandesh_logger.SandeshLogger類代碼示例

本文整理匯總了Python中pysandesh.sandesh_logger.SandeshLogger的典型用法代碼示例。如果您正苦於以下問題:Python SandeshLogger類的具體用法?Python SandeshLogger怎麽用?Python SandeshLogger使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


在下文中一共展示了SandeshLogger類的8個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。

示例1: __init__

  def __init__(self, trans, strictRead=False, strictWrite=True):
    TProtocolBase.__init__(self, trans)
    sandesh_logger = SandeshLogger('TXMLProtocol')
    self._logger = sandesh_logger.logger()
    self._field_typename_dict = {
      TType.BOOL : self._XML_TYPENAME_BOOL,
      TType.BYTE : self._XML_TYPENAME_BYTE,
      TType.I16 : self._XML_TYPENAME_I16,
      TType.I32 : self._XML_TYPENAME_I32,
      TType.I64 : self._XML_TYPENAME_I64,
      TType.U16 : self._XML_TYPENAME_U16,
      TType.U32 : self._XML_TYPENAME_U32,
      TType.U64 : self._XML_TYPENAME_U64,
      TType.DOUBLE : self._XML_TYPENAME_DOUBLE,
      TType.STRING : self._XML_TYPENAME_STRING,
      TType.STRUCT : self._XML_TYPENAME_STRUCT,
      TType.MAP : self._XML_TYPENAME_MAP,
      TType.SET : self._XML_TYPENAME_SET,
      TType.LIST : self._XML_TYPENAME_LIST,
      TType.SANDESH : self._XML_TYPENAME_SANDESH,
      TType.XML : self._XML_TYPENAME_XML,
    }

    self._field_type_dict = {}
    # Now, interchange key and value
    for key, value in self._field_typename_dict.iteritems():
      self._field_type_dict[value] = key

    self._xml_tag = []
開發者ID:routelastresort,項目名稱:contrail-sandesh,代碼行數:29,代碼來源:TXMLProtocol.py

示例2: log

 def log(self, log_msg, level=SandeshLevel.SYS_DEBUG, fun=None):
     if fun:
         log = fun(level=level, og_msg=log_msg, sandesh=self._sandesh)
         log.send(sandesh=self._sandesh)
     else:
         self._sandesh.logger().log(
                 SandeshLogger.get_py_logger_level(level), log_msg)
開發者ID:Juniper,項目名稱:contrail-controller,代碼行數:7,代碼來源:vnc_logger.py

示例3: send_database_status

 def send_database_status(self):
     cassandra_status_uve = CassandraStatusUVE()
     cassandra_status = CassandraStatusData()
     cassandra_status.cassandra_compaction_task = CassandraCompactionTask()
     # Get compactionstats
     compaction_count = subprocess.Popen("nodetool compactionstats|grep 'pending tasks:'",
         shell=True, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
     op, err = compaction_count.communicate()
     if compaction_count.returncode != 0:
         msg = "Failed to get nodetool compactionstats " + err
         self.msg_log(msg, level=SandeshLevel.SYS_ERR)
         return
     cassandra_status.cassandra_compaction_task.pending_compaction_tasks = \
         self.get_pending_compaction_count(op)
     # Get the tpstats value
     tpstats_op = subprocess.Popen(["nodetool", "tpstats"], stdout=subprocess.PIPE,
                                   stderr=subprocess.PIPE)
     op, err = tpstats_op.communicate()
     if tpstats_op.returncode != 0:
         msg = "Failed to get nodetool tpstats " + err
         self.msg_log(msg, level=SandeshLevel.SYS_ERR)
         return
     cassandra_status.thread_pool_stats = self.get_tp_status(op)
     cassandra_status.name = socket.gethostname()
     cassandra_status_uve = CassandraStatusUVE(data=cassandra_status)
     msg = 'Sending UVE: ' + str(cassandra_status_uve)
     self.sandesh_global.logger().log(SandeshLogger.get_py_logger_level(
                         SandeshLevel.SYS_DEBUG), msg)
     cassandra_status_uve.send()
開發者ID:avallark,項目名稱:contrail-controller,代碼行數:29,代碼來源:database_event_manager.py

示例4: syslog

    def syslog(self, msg, *args, **kwargs):
        if not self._logger:
            return
        level = kwargs.get('level', 'info')
        if isinstance(level, int):
            from pysandesh.sandesh_logger import SandeshLogger
            level = SandeshLogger.get_py_logger_level(level)

        log_method = getattr(self._logger, level, self._logger.info)
        log_method(msg)
開發者ID:secof,項目名稱:contrail-controller,代碼行數:10,代碼來源:zkclient.py

示例5: syslog

 def syslog(self, log_msg, level):
     """ Log to syslog. """
     self._sandesh.logger().log(
         SandeshLogger.get_py_logger_level(level), log_msg)
開發者ID:cijohnson,項目名稱:contrail-controller,代碼行數:4,代碼來源:logger.py

示例6: msg_log

 def msg_log(self, msg, level):
     self.sandesh_global.logger().log(SandeshLogger.get_py_logger_level(
                         level), msg)
開發者ID:dsundarraj,項目名稱:contrail-controller,代碼行數:3,代碼來源:vrouter_event_manager.py

示例7: _logger

 def _logger(self, msg, level):
     logging.log(SandeshLogger.get_py_logger_level(level), msg)
開發者ID:dsundarraj,項目名稱:contrail-controller,代碼行數:2,代碼來源:test_alarmgen_config_handler.py

示例8: msg_log

 def msg_log(self, msg, level):
     self.logger.log(SandeshLogger.get_py_logger_level(level), msg)
開發者ID:cijohnson,項目名稱:contrail-controller,代碼行數:2,代碼來源:loadbalancer_stats.py


注:本文中的pysandesh.sandesh_logger.SandeshLogger類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。