Пример #1
0
    def __init__(self, namespace, name, lockType, callback):
        self._syncRoot = threading.RLock()
        self._namespace = namespace
        self._name = name
        self._lockType = lockType
        self._isActive = True
        self._isCanceled = False
        self._doneEvent = threading.Event()
        self._callback = callback
        self.reqID = str(uuid4())
        self._log = SimpleLogAdapter(self._log, {"ResName" : self.fullName, "ReqID" : self.reqID})

        # Becuase findCaller is expensive. We make sure it wll be printed before
        # calculating it
        if logging.getLogger("ResourceManager.ResourceRef").isEnabledFor(logging.WARN):
            createdAt = misc.findCaller(ignoreSourceFiles=[__file__], logSkipName="ResourceManager")
            self._log.debug("Request was made in '%s' line '%d' at '%s'", *createdAt)
Пример #2
0
    def __init__(self, namespace, name, lockType, callback):
        self._syncRoot = threading.RLock()
        self._namespace = namespace
        self._name = name
        self._lockType = lockType
        self._isActive = True
        self._isCanceled = False
        self._doneEvent = threading.Event()
        self._callback = callback
        self.reqID = str(uuid4())
        self._log = SimpleLogAdapter(self._log, {
            "ResName": self.fullName,
            "ReqID": self.reqID
        })

        # Because findCaller is expensive. We make sure it wll be printed
        # before calculating it
        if logging.getLogger("Storage.ResourceManager.ResourceRef").\
                isEnabledFor(logging.WARN):
            createdAt = misc.findCaller(ignoreSourceFiles=[__file__],
                                        logSkipName="ResourceManager")
            self._log.debug("Request was made in '%s' line '%d' at '%s'",
                            *createdAt)