本文整理汇总了Python中pysandesh.sandesh_base.Sandesh.uninit方法的典型用法代码示例。如果您正苦于以下问题:Python Sandesh.uninit方法的具体用法?Python Sandesh.uninit怎么用?Python Sandesh.uninit使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类pysandesh.sandesh_base.Sandesh
的用法示例。
在下文中一共展示了Sandesh.uninit方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: KubeManagerLogger
# 需要导入模块: from pysandesh.sandesh_base import Sandesh [as 别名]
# 或者: from pysandesh.sandesh_base.Sandesh import uninit [as 别名]
#.........这里部分代码省略.........
# Log to syslog.
self.syslog(log_msg, log_level)
# Log using the desired logging function.
self.log(log_msg, level=log_level, fun=logging_fun)
# WARNING.
def warning(self, log_msg, log_fun=None):
log_level = SandeshLevel.SYS_WARN
logging_fun = log_fun if log_fun else sandesh.KubeManagerWarningLog
# Log to syslog.
self.syslog(log_msg, log_level)
# Log using the desired logging function.
self.log(log_msg, level=log_level, fun=logging_fun)
# NOTICE.
def notice(self, log_msg, log_fun=None):
log_level = SandeshLevel.SYS_NOTICE
logging_fun = log_fun if log_fun else sandesh.KubeManagerNoticeLog
# Log to syslog.
self.syslog(log_msg, log_level)
# Log using the desired logging function.
self.log(log_msg, level=log_level, fun=logging_fun)
# INFO.
def info(self, log_msg, log_fun=None):
log_level = SandeshLevel.SYS_INFO
logging_fun = log_fun if log_fun else sandesh.KubeManagerInfoLog
# Log using the desired logging function.
self.log(log_msg, level=log_level, fun=logging_fun)
# DEBUG.
def debug(self, log_msg, log_fun=None):
log_level = SandeshLevel.SYS_DEBUG
logging_fun = log_fun if log_fun else sandesh.KubeManagerDebugLog
# Log using the desired logging function.
self.log(log_msg, level=log_level, fun=logging_fun)
def _redefine_sandesh_handles(self):
""" Register custom introspect handlers. """
# Register Pod DB introspect handler.
introspect.PodDatabaseList.handle_request =\
PodKM.sandesh_handle_db_list_request
# Register Namespace DB introspect handler.
introspect.NamespaceDatabaseList.handle_request =\
NamespaceKM.sandesh_handle_db_list_request
# Register Service DB introspect handler.
introspect.ServiceDatabaseList.handle_request =\
ServiceKM.sandesh_handle_db_list_request
# Register NetworkPolicy DB introspect handler.
introspect.NetworkPolicyDatabaseList.handle_request =\
NetworkPolicyKM.sandesh_handle_db_list_request
# Register Ingress DB introspect handler.
introspect.IngressDatabaseList.handle_request =\
IngressKM.sandesh_handle_db_list_request
def sandesh_init(self):
""" Init Sandesh """
self._sandesh = Sandesh()
# Register custom sandesh request handlers.
self._redefine_sandesh_handles()
# Initialize Sandesh generator.
self._sandesh.init_generator(
self._module["name"], self._module["hostname"],
self._module["node_type_name"], self._module["instance_id"],
self._args.random_collectors, 'kube_manager_context',
int(self._args.http_server_port),
['cfgm_common', 'kube_manager'],
logger_class=self._args.logger_class,
logger_config_file=self._args.logging_conf,
config=self._args.sandesh_config)
# Set Sandesh logging params.
self._sandesh.set_logging_params(
enable_local_log=self._args.log_local,
category=self._args.log_category, level=self._args.log_level,
file=self._args.log_file, enable_syslog=self._args.use_syslog,
syslog_facility=self._args.syslog_facility)
# Connect to collector.
ConnectionState.init(
self._sandesh, self._module["hostname"], self._module["name"],
self._module["instance_id"],
staticmethod(ConnectionState.get_process_state_cb),
NodeStatusUVE, NodeStatus, self._module["table"])
def sandesh_uninit(self):
self._sandesh.uninit()