當前位置: 首頁>>代碼示例>>Python>>正文


Python application.Log類代碼示例

本文整理匯總了Python中application.Log的典型用法代碼示例。如果您正苦於以下問題:Python Log類的具體用法?Python Log怎麽用?Python Log使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


在下文中一共展示了Log類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。

示例1: load

 def load(self, name, vmId, port, password):
     self.vmInfo = {'name': name, 'port': port, 'password': password, 'obj': self}
     try:
         self.mach = self.vbox.findMachine(name)
         desc = self.mach.getGuestPropertyValue('vm_desc')
         self.vmInfo['desc'] = str(desc) if desc else ''
         type_ = self.mach.getGuestPropertyValue('vm_type')
         if not type_ or int(type_) not in (VirtualMachine.Type_Stand, VirtualMachine.Type_Id_Extract):
             self.vmInfo['status'] = VirtualMachine.Status_Invalid
             self.vmInfo['type'] = -1
             return self.vmInfo
         self.vmInfo['type'] = int(type_)
         if self.mach.state == self.mgr.constants.MachineState_Running:
             self.vmInfo['status'] = VirtualMachine.Status_Running
             return self.vmInfo
         self.session = self.mgr.mgr.getSessionObject(self.vbox)
         self.mach.lockMachine(self.session, self.mgr.constants.LockType_Write)
         mutable = self.session.machine
         mutable.setGuestPropertyValue('vm_vmId', vmId)
         mutable.VRDEServer.setVRDEProperty('VNCPassword', str(password))
         mutable.VRDEServer.setVRDEProperty('TCP/Ports', str(port))
         mutable.VRDEServer.enabled = True
         mutable.saveSettings()
         self.session.unlockMachine()
     except Exception, e:
         Log.e(getExceptionInfo(e))
         return
開發者ID:RoyZeng,項目名稱:ivy-webchat,代碼行數:27,代碼來源:virtualbox.py

示例2: read

    def read(self):
        try:
            message = self.socket.recv(4096)
        except Exception as e:
            Log.e(getExceptionInfo(e))
            return Client.ReadError

        if len(message) == 0:
            return Client.NoMessage

        self.buf += message

        while len(self.buf) > 4:
            length = int(self.buf[0:4])
            if not len(self.buf) >= length + 4:
                break
            msg = self.buf[4: length + 4]
            self.buf = self.buf[length + 4:]
            message = Message()
            if not message.loads(msg):
                Log.w(u'Unknown Message')
            else:
                self.requests.put(message)

        return Client.NewMessage
開發者ID:RoyZeng,項目名稱:ivy-webchat,代碼行數:25,代碼來源:network_test.py

示例3: __getitem__

 def __getitem__(self, item):
     param = None
     try:
         param = self.params[item]
     except Exception as e:
         Log.e(getExceptionInfo(e))
     return param
開發者ID:RoyZeng,項目名稱:ivy-webchat,代碼行數:7,代碼來源:message.py

示例4: deleteSelectedItems

 def deleteSelectedItems(self):
     selection = self.gpsTable.selectionModel()
     indexes = selection.selectedRows()
     #uuids: {clientId: [uuid,]}
     uuids = {}
     for index in indexes:
         uuid_ = self.gpsModel.gpsItems[index.row()].id()
         clientId = application.lookUpClientIdByResourceId(uuid_)
         if clientId in uuids:
             uuids[clientId].append(uuid_)
         else:
             uuids[clientId] = [uuid_]
     if len(uuids) == 0:
         return
     for clientId in uuids:
         message = Message(cmd=Message.CMD_DELETE_GPS)
         message['ids'] = uuids[clientId]
         EventManager.trigger(Event('Client.replyReady.' + clientId, message))
         self.deleteGpsItems(uuids[clientId])
         for uuid_ in uuids[clientId]:
             toolBarId = application.lookUpToolBarIdByResourceId(uuid_)
             if toolBarId:
                 EventManager.trigger(Event('ToolBar.changeState.' + toolBarId, True))
             else:
                 Log.e(u'未找到對應的ToolBar')
開發者ID:RoyZeng,項目名稱:ivy-webchat,代碼行數:25,代碼來源:gps_list.py

示例5: dumps

 def dumps(self):
     if 'cmd' not in self.params:
         Log.e('cmd不存在')
         return None
     message = json.dumps(self.params)
     Log.i('生成Message: ' + message)
     return bytes(message).encode('utf-8')
開發者ID:RoyZeng,項目名稱:ivy-webchat,代碼行數:7,代碼來源:message_test.py

示例6: dispatchRequest

 def dispatchRequest(self, request):
     cmd = request.getCMD()
     if not cmd:
         Log.i('缺少cmd參數')
     identifier = request.getParam('identifier')
     EventManager.trigger(Event('Socket.addReply.' + identifier,
                                request))
開發者ID:RoyZeng,項目名稱:ivy-webchat,代碼行數:7,代碼來源:webchat.py

示例7: getParam

 def getParam(self, name):
     param = None
     try:
         param = self.request[name]
     except Exception as e:
         Log.e(getExceptionInfo(e))
     return param
開發者ID:RoyZeng,項目名稱:ivy-webchat,代碼行數:7,代碼來源:message_wrapper.py

示例8: handleDeleteGpsOk

 def handleDeleteGpsOk(self, request):
     ids = request['ids']
     for id_ in ids:
         toolBarId = application.lookUpToolBarIdByResourceId(id_)
         if toolBarId:
             EventManager.trigger(Event('ToolBar.changeState.' + toolBarId, False))
         else:
             Log.e(u'未找到需要改變狀態的ToolBar')
         application.delItemFromToolBar(id_)
開發者ID:RoyZeng,項目名稱:ivy-webchat,代碼行數:9,代碼來源:external.py

示例9: lastInsertRowId

 def lastInsertRowId(self):
     query = QSqlQuery(self.db)
     if not query.exec_('SELECT last_insert_rowid()'):
         Log.e('獲取最後插入id失敗')
         return False
     if not query.next():
         Log.e('獲取最後插入id失敗')
         return False
     return query.value(0)
開發者ID:RoyZeng,項目名稱:ivy-webchat,代碼行數:9,代碼來源:database.py

示例10: updateGps

 def updateGps(self, request):
     clientId = request.getParam('clientId')
     if not clientId:
         Log.e('ExternalDispatcher.updateGps: 權限不足')
         return
     if clientId not in self.server.clients:
         Log.e('ExternalDispatcher.updateGps: 該客戶端在服務器中不存在')
         return
     EventManager.trigger(Event('DataCenter.updateGps', request['id'], request['desc'], clientId))
開發者ID:RoyZeng,項目名稱:ivy-webchat,代碼行數:9,代碼來源:external.py

示例11: queryAccount

 def queryAccount(self, request):
     clientId = request.getParam('clientId')
     if not clientId:
         Log.e('ExternalDispatcher.queryAccount: 權限不足')
         return
     if clientId not in self.server.clients:
         Log.e('ExternalDispatcher.queryAccount: 該客戶端在服務器中不存在')
         return
     EventManager.trigger(Event('DataCenter.loadAllAccount', clientId))
開發者ID:RoyZeng,項目名稱:ivy-webchat,代碼行數:9,代碼來源:external.py

示例12: reply

 def reply(self):
     reply = self.replies.get()
     data = reply.dumps()
     if data:
         try:
             self.socket.send(bytes(str(len(data)).zfill(4)) + data)
             return self.WriteSuccess
         except Exception as e:
             Log.e("Can't send reply: " + getExceptionInfo(e))
             return self.WriteError
開發者ID:RoyZeng,項目名稱:ivy-webchat,代碼行數:10,代碼來源:network.py

示例13: clearVmForClient

 def clearVmForClient(self, clientId):
     if clientId in self.externalToVm:
         for vm in self.externalToVm[clientId]:
             success, vmInfo = self.vm.closeMachine(vm[0])
             if not success:
                 Log.e('關閉虛擬機失敗:' + vm[1]['name'])
                 continue
             message = Message(cmd=Message.CMD_VM_UPDATED, vmId=vm[0], status=VirtualMachine.Status_Idle)
             EventManager.trigger(Event('Message.broadcast', message, ()))
         del self.externalToVm[clientId]
開發者ID:RoyZeng,項目名稱:ivy-webchat,代碼行數:10,代碼來源:external.py

示例14: addRecord

 def addRecord(self, table, **kwargs):
     model = QSqlTableModel(self, self.db)
     model.setTable(table)
     record = model.record()
     for field in kwargs:
         record.setValue(field, kwargs[field])
     if not model.insertRecord(-1, record):
         Log.e('添加記錄失敗')
         return False
     else:
         model.submitAll()
開發者ID:RoyZeng,項目名稱:ivy-webchat,代碼行數:11,代碼來源:database.py

示例15: dispatchRequest

 def dispatchRequest(self, request):
     cmd = request.getCMD()
     if cmd in self.callbacks:
         self.callbacks[cmd](request)
     elif Message.CMD_BRIDGE_START <= cmd < Message.CMD_WEBCHAT_END:
         try:
             webchatId = request.getParam('webchatId')
             EventManager.trigger(Event('Socket.addReply.' + webchatId, request))
         except Exception as e:
             Log.e(getExceptionInfo(e))
     else:
         Log.w('未實現的命令: ' + str(cmd))
開發者ID:RoyZeng,項目名稱:ivy-webchat,代碼行數:12,代碼來源:external.py


注:本文中的application.Log類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。