本文整理汇总了Python中pyconfdlib._log函数的典型用法代码示例。如果您正苦于以下问题:Python _log函数的具体用法?Python _log怎么用?Python _log使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了_log函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: deepConvertPyValueToConfdValue
def deepConvertPyValueToConfdValue (pyValue, confdValuePtr, confdValIndex=0):
"""
This function performs a deep convertion of a python Value object to a confd_value_t object.
It reallocates data memory, making the confd_value_t object its owner.
Note: When using this function the it is NOT mandatory for the python Value object to exist as long as the confd_value_t object exists
Note 2: confd_free_value MUST be activated on the confd_value_t object filled by this function as it is the owner of allocated memory
confdValuePtr must be pre-allocated
"""
for logFunc in pyconfdlib._log("deep-convert-pyvalue-to-confd-value").debug4Func(): logFunc("deepConvertPyValueToConfdValue called. pyValue=%s, confdValuePtr=%s, confdValIndex=%d", pyValue, str(confdValuePtr), confdValIndex)
if not pyValue or not confdValuePtr:
for logFunc in pyconfdlib._log("deep-convert-pyvalue-to-confd-value-invalid-args").errorFunc(): logFunc("deepConvertPyValueToConfdValue invalid args: pyValue=%s, confdValuePtr=%s", pyValue, str(confdValuePtr))
return ReturnCodes.kGeneralError
type_ = pyValue.getType()
if (type_ == Value.kString):
pyconfdlib.dll.py_CONFD_SET_STR_DUP(confdValuePtr, confdValIndex, pyValue._value)
elif (type_ == Value.kBuf):
(buf, len_) = pyValue._value
pyconfdlib.dll.py_CONFD_SET_BUF_DUP(confdValuePtr, confdValIndex, buf, len_)
elif (type_ == Value.kBinary):
pyconfdlib.dll.py_CONFD_SET_BINARY_DUP(confdValuePtr, confdValIndex, pyValue._value, len(pyValue._value))
elif (type_ == Value.kOid):
buf = pyValue._value
arr = pyconfdlib.Int32ArrCreator(buf)
pyconfdlib.dll.py_CONFD_SET_OID_DUP(confdValuePtr, confdValIndex, arr, len(buf))
else:
ConfdValueLow.shallowConvertPyValueToConfdValue(pyValue, confdValuePtr, confdValIndex)
for logFunc in pyconfdlib._log("deep-convert-pyvalue-to-confd-value-done").debug4Func(): logFunc(
"deepConvertPyValueToConfdValue done. pyValue=%s, confdValuePtr=%s, type=%d, confdValIndex=%d",
pyValue, ConfdValueLow.ConfdValueToStr(confdValuePtr), ConfdValueLow.getConfdValueType(confdValuePtr), confdValIndex)
return ReturnCodes.kOk
示例2: deepConvertConfdHKeyPathToPyKeyPath
def deepConvertConfdHKeyPathToPyKeyPath (confdHKeyPathPtr, pyKeyPath):
"""
This function performs a deep convertion of a confd_hkeypath object to a python KeyPath object.
It reallocates all data memory, making the python KeyPath object its owner.
pyKeyPath must be pre-constructed
"""
for logFunc in pyconfdlib._log("deep-convert-confd-hkeypath-to-pykeypath").debug4Func(): logFunc("deepConvertConfdHKeyPathToPyKeyPath called. confdHKeyPathPtr=%s, pyKeyPath=%s", ConfdHKeyPathLow.ConfdHKeyPathToStr(confdHKeyPathPtr), pyKeyPath)
if not pyKeyPath or not confdHKeyPathPtr:
for logFunc in pyconfdlib._log("deep-convert-confd-value-to-pyvalue-invalid-args").errorFunc(): logFunc("deepConvertConfdValueToPyValue invalid args: confdHKeyPathPtr=%s, pyKeyPath=%s", ConfdHKeyPathLow.ConfdHKeyPathToStr(confdHKeyPathPtr), pyKeyPath)
return ReturnCodes.kGeneralError
confdKeyPathLen = pyconfdlib.dll.py_getHkeypathLen(confdHKeyPathPtr)
for logFunc in pyconfdlib._log("deep-convert-confd-hkeypath-to-pykeypath-len").debug4Func(): logFunc("deepConvertConfdHKeyPathToPyKeyPath: confdKetPathLen=%d, confdHKeyPathPtr=%s, pyKeyPath=%s", confdKeyPathLen, ConfdHKeyPathLow.ConfdHKeyPathToStr(confdHKeyPathPtr), pyKeyPath)
for i in range(confdKeyPathLen):
level = []
for j in range(pyconfdlib.MAXKEYLEN):
confdValPtr = pyconfdlib.dll.py_getHkeypathValue(confdHKeyPathPtr, confdKeyPathLen-1-i, j, False)
pyValue = Value()
rc = ConfdValueLow.deepConvertConfdValueToPyValue(confdValPtr, pyValue)
if rc != ReturnCodes.kOk:
for logFunc in pyconfdlib._log("deep-convert-confd-hkeypath-to-pykeypath-convert-keypath-failed").errorFunc(): logFunc("deepConvertConfdHKeyPathToPyKeyPath: deepConvertConfdValueToPyValue "\
"failed: i=%d, j=%d, confdHKeyPathPtr=%s, pyKeyPath=%s, rc=%s", i, j, ConfdHKeyPathLow.ConfdHKeyPathToStr(confdHKeyPathPtr), pyKeyPath, str(rc))
return ReturnCodes.kGeneralError
if pyValue.getType() == Value.kEmpty:
break
level.append(pyValue)
if level:
#for logFunc in pyconfdlib._log("deep-convert-confd-hkeypath-to-pykeypath-appending").debug4Func(): logFunc("deepConvertConfdHKeyPathToPyKeyPath: appending level=%s", level)
pyKeyPath._key.append(level)
for logFunc in pyconfdlib._log("deep-convert-confd-hkeypath-to-pykeypath-done").debug4Func(): logFunc("deepConvertConfdHKeyPathToPyKeyPath done. confdHKeyPathPtr=%s, pyKeyPath=%s", ConfdHKeyPathLow.ConfdHKeyPathToStr(confdHKeyPathPtr), pyKeyPath)
return ReturnCodes.kOk
示例3: maapi_set_values
def maapi_set_values (sock, thandle, tagValues, keyPath):
if not pyconfdlib.checkTypes({sock : socket.socket, thandle : int}):
return pyconfdlib.CONFD_BAD_PYTHON_USAGE
for logFunc in pyconfdlib._log("maapi-set-values").debug3Func(): logFunc("called. keyPath=%s, thandle=%s", keyPath, thandle)
numOfValues = tagValues.getLen()
confdTagValueTPtr = tag_values.TagValuesLow.allocConfdTagValues(numOfValues)
res = tag_values.TagValuesLow.deepConvertPyTagValuesToConfdTagValues(tagValues, confdTagValueTPtr)
if res != ReturnCodes.kOk:
for logFunc in pyconfdlib._log("maapi-set-values-deep-convert-failed").errorFunc(): logFunc(
"deepConvertPyTagValuesToConfdTagValues(tagValues=%s, confdTagValueTPtr=%s) res=%s",
tagValues, str(confdTagValueTPtr), str(res))
return ReturnCodes.kGeneralError
for logFunc in pyconfdlib._log("maapi-set-values-calling-library").debug3Func(): logFunc("calling library. keyPath=%s", keyPath)
res = pyconfdlib.dll.py_maapi_set_values(sock.fileno(), thandle, confdTagValueTPtr, numOfValues, keyPath.getCannonicalStr())
if res != pyconfdlib.CONFD_OK:
for logFunc in pyconfdlib._log("maapi-set-values-lib-failed").errorFunc(): logFunc("py_maapi_set_values() failed. res=%s", res)
return ReturnCodes.kGeneralError
for logFunc in pyconfdlib._log("maapi-set-values-library-done").debug3Func(): logFunc("library done. keyPath=%s. val=%s", keyPath, tag_values.TagValuesLow.ConfdTagValueToStr(confdTagValueTPtr, 0))
tag_values.TagValuesLow.deallocConfdTagValue(confdTagValueTPtr)
return ReturnCodes.kOk
示例4: confd_notification_send_snmp
def confd_notification_send_snmp (notificationCtx, notificationName, snmpVarbinds):
if not pyconfdlib.checkTypes({notificationName : str}):
return pyconfdlib.CONFD_BAD_PYTHON_USAGE
for logFunc in pyconfdlib._log("confd-send-snmp").debug3Func(): logFunc("called. notificationCtx=%s, notificationName=%s, snmpVarbinds=%s", notificationCtx, notificationName, snmpVarbinds)
numOfVarbinds = snmpVarbinds.getLen()
confdSnmpVarbindPtr = snmp_varbind.SnmpVarbindLow.allocSnmpVarbind(numOfVarbinds)
res = snmp_varbind.SnmpVarbindLow.deepConvertPySnmpVarbindToConfdSnmpVarbind(snmpVarbinds, confdSnmpVarbindPtr)
if res != ReturnCodes.kOk:
for logFunc in pyconfdlib._log("confd-send-snmp-deep-convert-failed").errorFunc(): logFunc(
"deepConvertPySnmpVarbindToConfdSnmpVarbind(snmpVarbind=%s, confdSnmpVarbindPtr=%s) res=%s",
snmpVarbind, str(confdSnmpVarbindPtr), str(res))
return ReturnCodes.kGeneralError
for logFunc in pyconfdlib._log("confd-send-snmp-calling-library").debug3Func(): logFunc("calling library. notificationCtx=%s, notificationName=%s, snmpVarbinds=%s", notificationCtx, notificationName, snmpVarbinds)
res = pyconfdlib.dll.py_confd_notification_send_snmp(notificationCtx, notificationName, confdSnmpVarbindPtr, numOfVarbinds)
if res != pyconfdlib.CONFD_OK:
for logFunc in pyconfdlib._log("confd-send-snmp-lib-failed").errorFunc(): logFunc("py_confd_notification_send_snmp() failed. res=%s", res)
return ReturnCodes.kGeneralError
for logFunc in pyconfdlib._log("confd-send-snmp-library-done").debug3Func(): logFunc("library done.")
snmp_varbind.SnmpVarbindLow.deallocSnmpVarbind(confdSnmpVarbindPtr)
return ReturnCodes.kOk
示例5: copyPartial
def copyPartial (self, other, lenToCopy):
for logFunc in pyconfdlib._log("copy-partial").debug4Func(): logFunc("copyPartial called. self=%s, other=%s, lenToCopy=%d",
str(self), str(other), lenToCopy)
if other.getLen() < lenToCopy:
for logFunc in pyconfdlib._log("copy-partial-too-short").errorFunc(): logFunc("copyPartial other keypath is too short. self=%s, other=%s, , otherLen=%d, lenToCopy=%d",
str(self), str(other), other.getLen(), lenToCopy)
self._key = copy.deepcopy(other._key[:lenToCopy])
for logFunc in pyconfdlib._log("copy-partial-done").debug4Func(): logFunc("copyPartial done. self=%s, other=%s, lenToCopy=%d",
str(self), str(other), lenToCopy)
示例6: getListKeys
def getListKeys (self):
for logFunc in pyconfdlib._log("get-list-keys").debug4Func(): logFunc("getListKeys called. self=%s", str(self))
keys = []
for level in self._key:
if level:
if not level[0].isXmlTag():
keys.append(copy.deepcopy(level[0]))
for logFunc in pyconfdlib._log("get-list-keys-done").debug4Func(): logFunc("getListKeys done. self=%s, keys=%s", str(self), [str(key) for key in keys])
return keys
示例7: joinKeyPath
def joinKeyPath (self, keyPathToAdd):
for logFunc in pyconfdlib._log("join-key-path").debug4Func(): logFunc("joinKeyPath called. self=%s, keyPathToAdd=%s", str(self), str(keyPathToAdd))
if (self.getLen() + len(keyPathToAdd._key)) > pyconfdlib.MAXDEPTH:
for logFunc in pyconfdlib._log("join-key-path-too-long").errorFunc(): logFunc("joinKeyPath: result is too long, cannot join keypath. self=%s, selfLen=%d, keyPathToAdd=%d", str(self), self.getLen(), str(keyPathToAdd), len(keyPathToAdd._key))
return ReturnCodes.kGeneralError
self._key.extend(copy.deepcopy(keyPathToAdd._key))
for logFunc in pyconfdlib._log("join-key-path-done").debug4Func(): logFunc("joinKeyPath done. self=%s", self._key)
for logFunc in pyconfdlib._log("join-key-path-done").debug4Func(): logFunc("joinKeyPath done. self=%s, keyPathToAdd=%s", str(self), str(keyPathToAdd))
return ReturnCodes.kOk
示例8: getPrefix
def getPrefix (self):
for logFunc in pyconfdlib._log("get-prefix").debug4Func(): logFunc("called. self=%s", str(self))
if self._key and self._key[0]:
val = self._key[0][0]
(tag, ns, prefix) = val.asXmlTag()
if not prefix:
for logFunc in pyconfdlib._log("get-prefix-as-xml-tag-failed").errorFunc(): logFunc("val.asXmlTag() returned None. val=%s, self=%s", str(val), str(self))
return None
for logFunc in pyconfdlib._log("get-prefix-done").debug4Func(): logFunc("done. self=%s, prefix=%s", str(self), prefix)
return prefix
示例9: getNameSpaceId
def getNameSpaceId (self):
for logFunc in pyconfdlib._log("get-namespace-id").debug4Func(): logFunc("getNameSpaceId called. self=%s", str(self))
if self._key and self._key[0]:
val = self._key[0][0]
(tag, ns, prefix) = val.asXmlTag()
if not ns:
for logFunc in pyconfdlib._log("get-namespace-id-as-xml-tag-failed").errorFunc(): logFunc("val.asXmlTag() returned None. val=%s, self=%s", str(val), str(self))
return None
for logFunc in pyconfdlib._log("get-namespace-id-done").debug4Func(): logFunc("getNameSpaceId done. self=%s, ns=%s", str(self), ns)
return ns
示例10: func2
def func2 (self, tctx, confdKeypathPtr, next):
for logFunc in pyconfdlib._log("confd_register_data_cb-func2-called").debug2Func(): logFunc("confd_register_data_cb::func2() called: tctx=%s, confdKeypathPtr=%s, next=%s", tctx, confdKeypathPtr, next)
pyKeyPath = key_path.KeyPath()
ret = key_path.ConfdHKeyPathLow.deepConvertConfdHKeyPathToPyKeyPath(confdKeypathPtr, pyKeyPath)
if ret != ReturnCodes.kOk:
for logFunc in pyconfdlib._log("confd_register_data_cb-func2-failed-convert").errorFunc(): logFunc("confd_register_data_cb::func2() deepConvertConfdHKeyPathToPyKeyPath() failed: tctx=%s, confdKeypathPtr=%s, next=%s,ret=%s",
tctx, confdKeypathPtr, next, ret)
return pyconfdlib.CONFD_ERR
ret=self.callBack(pyconfdlib.ConfdTransContext(tctx), self.callpoint, self.callBackData, pyKeyPath, next)
pyconfdlib.checkTypes({ret : pyconfdlib.ConfdReturnCode})
return ret.getValue()
示例11: insertToKeyPathAt
def insertToKeyPathAt (self, value, pos):
for logFunc in pyconfdlib._log("insert-to-key-path-at").debug4Func(): logFunc("insertToKeyPathAt called. self=%s, value=%s, pos=%s", str(self), str(value), str(pos))
if self.getLen() == pyconfdlib.MAXDEPTH:
for logFunc in pyconfdlib._log("add-key-path-postfix-too-long").errorFunc(): logFunc("addKeyPathPostfix: keypath is at max depth, cannot add a postfix. self=%s, value=%s", str(self), str(value))
return ReturnCodes.kGeneralError
if isinstance(value, list):
self._key.insert(pos, copy.deepcopy(value))
else:
self._key.insert(pos, [copy.deepcopy(value)])
for logFunc in pyconfdlib._log("insert-to-key-path-at-done").debug4Func(): logFunc("insertToKeyPathAt done. self=%s, value=%s, pos=%s", str(self), str(value), str(pos))
return ReturnCodes.kOk
示例12: addKeyPathPrefix
def addKeyPathPrefix (self, value):
for logFunc in pyconfdlib._log("add-key-path-prefix").debug4Func(): logFunc("addKeyPathPrefix called. self=%s, value=%s", str(self), str(value))
if self.getLen() == pyconfdlib.MAXDEPTH:
for logFunc in pyconfdlib._log("add-key-path-prefix-too-long").errorFunc(): logFunc("addKeyPathPrefix: keypath is at max depth, cannot add a prefix. self=%s, value=%s", str(self), str(value))
return ReturnCodes.kGeneralError
if isinstance(value, list):
self._key.insert(0, copy.deepcopy(value))
else:
self._key.insert(0, [copy.deepcopy(value)])
for logFunc in pyconfdlib._log("add-key-path-prefix-done").debug4Func(): logFunc("addKeyPathPrefix done. self=%s, value=%s", str(self), str(value))
return ReturnCodes.kOk
示例13: getKeyPathPostfixFlattened
def getKeyPathPostfixFlattened (self, pathToRemove, leaveLowestKey):
resKeyPath = KeyPath()
for logFunc in pyconfdlib._log("get-key-path-postfix-flattened").debug4Func(): logFunc("getKeyPathPostfixFlattened called. self=%s, keyPathToRemove=%s, resKeyPath=%s, leaveLowestKey=%s",
str(self), str(pathToRemove), str(resKeyPath), leaveLowestKey)
for i, level in enumerate(self._key):
if i < pathToRemove.getLen():
continue
if level[0].isXmlTag():
resKeyPath._key.append(copy.deepcopy(level))
for logFunc in pyconfdlib._log("get-key-path-postfix-flattened-done").debug4Func(): logFunc("getKeyPathPostfixFlattened done. self=%s, keyPathToRemove=%s, resKeyPath=%s, leaveLowestKey=%s",
str(self), str(pathToRemove), str(resKeyPath), leaveLowestKey)
return resKeyPath
示例14: isDescendantOf
def isDescendantOf (self, other):
for logFunc in pyconfdlib._log("is-descendant-of").debug4Func(): logFunc("isDescendantOf called. self=%s, other=%s", str(self), other)
if self.getLen() >= other.getLen():
for logFunc in pyconfdlib._log("is-descendant-of-too-short").debug4Func(): logFunc("isDescendantOf False. self too short. self=%s, other=%s", str(self), other)
return False
if self.isEqualLen(other, self.getLen()):
for logFunc in pyconfdlib._log("is-descendant-of-true").debug4Func(): logFunc("isDescendantOf True. self=%s, other=%s", str(self), other)
return True
for logFunc in pyconfdlib._log("is-descendant-of-false").debug4Func(): logFunc("isDescendantOf False. isEqualLen() returned False. self=%s, other=%s", str(self), other)
return False
示例15: validate
def validate(self, tctx, confdKeypathPtr, val):
for logFunc in pyconfdlib._log("confd_register_range_valpoint_cb-validate-called").debug2Func(): logFunc("confd_register_range_valpoint_cb::validate() called: tctx=%s, confdKeypathPtr=%s, val=%s", tctx, confdKeypathPtr, val)
pyKeyPath = key_path.KeyPath()
ret = key_path.ConfdHKeyPathLow.deepConvertConfdHKeyPathToPyKeyPath(confdKeypathPtr, pyKeyPath)
if ret != ReturnCodes.kOk:
for logFunc in pyconfdlib._log("confd_register_range_valpoint_cb-validate-failed-convert").errorFunc(): logFunc("confd_register_range_valpoint_cb::validate() deepConvertConfdHKeyPathToPyKeyPath() failed: tctx=%s, confdKeypathPtr=%s, val=%s,ret=%s",
tctx, confdKeypathPtr, val, ret)
return pyconfdlib.CONFD_ERR
valP=None
if val:
valP=ConfdValues(val)
ret=self.callBack(pyconfdlib.ConfdTransContext(tctx), self.validationPoint, self.callBackData, pyKeyPath, valP)
pyconfdlib.checkTypes({ret : pyconfdlib.ConfdReturnCode})
return ret.getValue()