本文整理汇总了Python中pysandesh.sandesh_logger.SandeshLogger.get_py_logger_level方法的典型用法代码示例。如果您正苦于以下问题:Python SandeshLogger.get_py_logger_level方法的具体用法?Python SandeshLogger.get_py_logger_level怎么用?Python SandeshLogger.get_py_logger_level使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类pysandesh.sandesh_logger.SandeshLogger
的用法示例。
在下文中一共展示了SandeshLogger.get_py_logger_level方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: log
# 需要导入模块: from pysandesh.sandesh_logger import SandeshLogger [as 别名]
# 或者: from pysandesh.sandesh_logger.SandeshLogger import get_py_logger_level [as 别名]
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)
示例2: send_database_status
# 需要导入模块: from pysandesh.sandesh_logger import SandeshLogger [as 别名]
# 或者: from pysandesh.sandesh_logger.SandeshLogger import get_py_logger_level [as 别名]
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()
示例3: syslog
# 需要导入模块: from pysandesh.sandesh_logger import SandeshLogger [as 别名]
# 或者: from pysandesh.sandesh_logger.SandeshLogger import get_py_logger_level [as 别名]
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)
示例4: syslog
# 需要导入模块: from pysandesh.sandesh_logger import SandeshLogger [as 别名]
# 或者: from pysandesh.sandesh_logger.SandeshLogger import get_py_logger_level [as 别名]
def syslog(self, log_msg, level):
""" Log to syslog. """
self._sandesh.logger().log(
SandeshLogger.get_py_logger_level(level), log_msg)
示例5: msg_log
# 需要导入模块: from pysandesh.sandesh_logger import SandeshLogger [as 别名]
# 或者: from pysandesh.sandesh_logger.SandeshLogger import get_py_logger_level [as 别名]
def msg_log(self, msg, level):
self.sandesh_global.logger().log(SandeshLogger.get_py_logger_level(
level), msg)
示例6: _logger
# 需要导入模块: from pysandesh.sandesh_logger import SandeshLogger [as 别名]
# 或者: from pysandesh.sandesh_logger.SandeshLogger import get_py_logger_level [as 别名]
def _logger(self, msg, level):
logging.log(SandeshLogger.get_py_logger_level(level), msg)
示例7: msg_log
# 需要导入模块: from pysandesh.sandesh_logger import SandeshLogger [as 别名]
# 或者: from pysandesh.sandesh_logger.SandeshLogger import get_py_logger_level [as 别名]
def msg_log(self, msg, level):
self.logger.log(SandeshLogger.get_py_logger_level(level), msg)