diff -up cmpi-bindings-0.5.2/swig/cmpi_callbacks.i.trace cmpi-bindings-0.5.2/swig/cmpi_callbacks.i --- cmpi-bindings-0.5.2/swig/cmpi_callbacks.i.trace 2012-05-04 15:47:18.000000000 +0200 +++ cmpi-bindings-0.5.2/swig/cmpi_callbacks.i 2012-12-05 09:18:07.044502907 +0100 @@ -44,6 +44,14 @@ typedef struct _CMPIBroker {} CMPIBroker RAISE_IF(CMLogMessage($self, severity, id, text, NULL)); } + void TraceMessage( + int severity, + const char *component, + const char *text) + { + RAISE_IF(CMTraceMessage($self, severity, component, text, NULL)); + } + int version() { return CBBrokerVersion($self); diff -up cmpi-bindings-0.5.2/swig/python/cmpi_pywbem_bindings.py.trace cmpi-bindings-0.5.2/swig/python/cmpi_pywbem_bindings.py --- cmpi-bindings-0.5.2/swig/python/cmpi_pywbem_bindings.py.trace 2012-12-05 09:18:07.040502914 +0100 +++ cmpi-bindings-0.5.2/swig/python/cmpi_pywbem_bindings.py 2012-12-05 09:49:03.673962824 +0100 @@ -384,6 +384,12 @@ _log_pri_map = { cmpi.CMPI_DEV_DEBUG :syslog.LOG_DEBUG, } +_trace_prefix_map = { + cmpi.CMPI_LEV_VERBOSE :"DEBG", + cmpi.CMPI_LEV_INFO :"INFO", + cmpi.CMPI_LEV_WARNING :"WARN", +} + class Logger(object): def __init__(self, broker, miname): #self.broker = ExceptionClassWrapper(broker) @@ -396,6 +402,14 @@ class Logger(object): if e.get_error_code() == cmpi.CMPI_RC_ERR_NOT_SUPPORTED: syslog.syslog(syslog.LOG_DAEMON | _log_pri_map[severity], '%s: %s' % (self.miname, msg)) + def __trace_message(self, severity, component, msg): + try: + self.broker.TraceMessage(severity, component, msg); + except cmpi.CMPIException, e: + if e.get_error_code() == cmpi.CMPI_RC_ERR_NOT_SUPPORTED: + # fall back to log_debug if tracing is not supported + self.log_debug("%s:%s: %s" % ( + component, _trace_prefix_map[severity], msg)) def log_error(self, msg): self.__log_message(cmpi.CMPI_SEV_ERROR, msg); def log_info(self, msg): @@ -404,6 +418,12 @@ class Logger(object): self.__log_message(cmpi.CMPI_SEV_WARNING, msg); def log_debug(self, msg): self.__log_message(cmpi.CMPI_DEV_DEBUG, msg); + def trace_verbose(self, component, msg): + self.__trace_message(cmpi.CMPI_LEV_VERBOSE, component, msg) + def trace_info(self, component, msg): + self.__trace_message(cmpi.CMPI_LEV_INFO, component, msg) + def trace_warn(self, component, msg): + self.__trace_message(cmpi.CMPI_LEV_WARNING, component, msg) class ProviderEnvironment(object): def __init__(self, proxy, ctx): @@ -437,7 +457,7 @@ class CMPIProxyProvider(object): env = ProviderEnvironment(self, None) provmod = miname if provmod[0] != '/': - provmod = '/usr/lib/pycim/' + provmod + provmod = '/usr/lib/python2.7/site-packages/pycim/' + provmod if not provmod.endswith('.py'): provmod+= '.py' self.proxy = ProviderProxy(env, provmod)