本文整理汇总了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;未经允许,请勿转载。 |
请发表评论