From 4aeb7e1df50ee3473e6affc39f3ddf564ad18238 Mon Sep 17 00:00:00 2001 From: Jarrod Johnson Date: Wed, 29 Jun 2016 11:29:05 -0400 Subject: [PATCH] Provide a simple global 'log' function As we implement internal processes with automation, provide a hook for code to convey information about situations encountered during background activity. Ultimately, it is intended to hook event forwarders for things like syslog/email/etc --- confluent_server/confluent/config/attributes.py | 13 ++++++++----- confluent_server/confluent/log.py | 8 ++++++++ 2 files changed, 16 insertions(+), 5 deletions(-) diff --git a/confluent_server/confluent/config/attributes.py b/confluent_server/confluent/config/attributes.py index 0303628b..9a12e218 100644 --- a/confluent_server/confluent/config/attributes.py +++ b/confluent_server/confluent/config/attributes.py @@ -207,16 +207,19 @@ node = { #IBM Flex)''', # 'appliesto': ['system'], # }, -# 'inventory.serialnumber': { +# 'id.serial': { # 'description': 'The manufacturer serial number of node', # }, -# 'inventory.uuid': { +# 'id.uuid': { # 'description': 'The UUID of the node as presented in DMI', # }, -# 'inventory.modelnumber': { +# 'id.modelnumber': { # 'description': 'The manufacturer dictated model number for the node', # }, -# 'inventory.snmpengineid': { +# 'id.modelname': { +# 'description': 'The manufacturer model label for the node', +# }, +# 'id.snmpengineid': { # 'description': 'The SNMP Engine id used by this node', # }, # 'secret.snmpuser': { @@ -235,7 +238,7 @@ node = { # 'description': ('SNMPv1 community string, it is highly recommended to' # 'step up to SNMPv3'), # }, -# 'secret.localadminpassphrase': { +# 'secret.adminpassword': { # 'description': ('The passphrase to apply to local root/administrator ' # 'account. ' # 'If the environment is 100% Linux, the value may be ' diff --git a/confluent_server/confluent/log.py b/confluent_server/confluent/log.py index 9269c359..2c3906be 100644 --- a/confluent_server/confluent/log.py +++ b/confluent_server/confluent/log.py @@ -722,3 +722,11 @@ class Logger(object): def closelog(self): self.handler.close() self.closer = None + +globaleventlog = None + + +def log(logdata=None, ltype=None, event=0, eventdata=None): + if globaleventlog is None: + globaleventlog = Logger('events') + globaleventlog.log(logdata, ltype, event, eventdata) \ No newline at end of file