本文整理汇总了Python中messenger.proto.xmpp.log_output.g_logOutput.error函数的典型用法代码示例。如果您正苦于以下问题:Python error函数的具体用法?Python error怎么用?Python error使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了error函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: logger
def logger(self, key):
if key in self.__loggers:
return self.__loggers[key]
else:
g_logOutput.error(CLIENT_LOG_AREA.GENERIC, 'Events logger is not found. Available loggers are', self.__loggers.keys())
return None
return None
示例2: error
def error(self, pyGlooxTag):
error = self._getError(pyGlooxTag)
if error:
g_messengerEvents.onErrorReceived(error)
else:
g_logOutput.error(_LOG_AREA.PY_WRAPPER, 'Error is not resolved on the client', self.__class__.__name__, pyGlooxTag.getXml())
self._result = TASK_RESULT.CLEAR
示例3: __doCallback
def __doCallback(self, result = None, error = None):
if error:
g_logOutput.error(CLIENT_LOG_AREA.GENERIC, 'Error has been received on requesting nicknames', error)
if self.__callback:
self.__callback(result or {}, error)
self.__callback = None
return
示例4: unregisterHandler
def unregisterHandler(self, event, handler):
if event in GLOOX_EVENT.ALL:
handlers = self.__handlers[event]
if handler in handlers:
handlers.remove(handler)
else:
g_logOutput.error(CLIENT_LOG_AREA.PY_WRAPPER, 'Event is not found', event)
示例5: __handleEvent
def __handleEvent(self, eventName, *args, **kwargs):
handlers = self.__handlers[eventName]
for handler in handlers:
try:
handler(*args, **kwargs)
except TypeError:
g_logOutput.error(CLIENT_LOG_AREA.PY_WRAPPER, ' Handler is invoked with error', handler)
LOG_CURRENT_EXCEPTION()
示例6: sync
def sync(self, jid, name = '', groups = None, to = _SUB.OFF, from_ = _SUB.OFF, defaultTask = None):
if not jid.getDatabaseID():
g_logOutput.error(_LOG_AREA.SYNC, 'JID "{0}" is invalid'.format(jid))
return
generator = self._getSyncGenerator(jid, name, groups, to, from_)
if not self._handleTasksResult(jid, generator) and defaultTask:
task = defaultTask(jid)
task.sync(name, groups, to, from_)
task.clear()
示例7: fini
def fini(self):
client = self.__client
for handlerName, _ in _GLOOX_EVENTS_LISTENERS:
if not hasattr(client, handlerName):
g_logOutput.error(CLIENT_LOG_AREA.PY_WRAPPER, 'Handler no is found', handlerName)
continue
setattr(client, handlerName, None)
self.__handlers.clear()
g_logOutput.clear()
ClientHolder._clearClient()
return
示例8: __handleMessage
def __handleMessage(self, _, msgType, body, jid, pyGlooxTag):
if msgType not in MESSAGE_TYPE_TO_ATTR:
return
message = MessageHandler(MESSAGE_TYPE_TO_ATTR[msgType]).handleTag(pyGlooxTag)
if not message.accountDBID:
g_logOutput.error(CLIENT_LOG_AREA.MESSAGE, 'Can not find sender info', pyGlooxTag.getXml())
return
if body:
message.body = self.__msgFilters.chainIn(message.accountDBID, body)
if not _REQUIRED_USER_TAGS.issubset(self.__receivedTags):
self.__pending.insert(0, (msgType, (jid, message)))
return
if msgType == MESSAGE_TYPE.CHAT or msgType == MESSAGE_TYPE.NORMAL and message.isHistory():
self.__chatSessions.addMessage(jid, message)
示例9: __handleMessage
def __handleMessage(self, _, msgType, body, jid, pyGlooxTag):
if msgType == MESSAGE_TYPE.CHAT:
state, info, sentAt = ChatMessageHandler().handleTag(pyGlooxTag)
if not info:
g_logOutput.error(CLIENT_LOG_AREA.MESSAGE, 'Can not find sender info', pyGlooxTag.getXml())
return
if body:
body = self.__msgFilters.chainIn(info['dbID'], body)
if _REQUIRED_USER_TAGS.issubset(self.__receivedTags):
self.__chatSessions.onMessageReceived(jid, body, state, info, sentAt)
else:
self.__pending.insert(0, (msgType, (jid,
body,
state,
info,
sentAt)))
示例10: __doConnect
def __doConnect(self):
client = self.client()
if not client.isDisconnected():
g_logOutput.warning(CLIENT_LOG_AREA.CONNECTION, 'Client already is connected(ing)', client.getConnectionAddress(), client.getConnectionState())
return
jid = self.__connectionsInfo.getPlayerFullJID()
if jid:
cType, host, port = self.__connectionsInfo.getNextConnection()
g_logOutput.debug(CLIENT_LOG_AREA.CONNECTION, 'Connect to XMPP sever', jid, host, port)
if cType == CONNECTION_IMPL_TYPE.TCP:
client.connect(str(jid), host, port)
elif cType == CONNECTION_IMPL_TYPE.BOSH:
client.connectBosh(str(jid), host, port, '/bosh/')
else:
g_logOutput.error(CLIENT_LOG_AREA.CONNECTION, 'This type of connection is not supported', cType)
else:
g_logOutput.error(CLIENT_LOG_AREA.CONNECTION, 'JID is empty')
示例11: __filterActions
def __filterActions(self):
for jid, action in self.__actions.items()[:]:
if action.isRunning():
continue
self.__actions.pop(jid)
room = action.getRoom()
result = action.getResult()
if room is None and result != ACTION_RESULT.DO_NOTHING:
g_logOutput.error(_LOG.MESSAGE, 'Action is failed', jid)
continue
if result & ACTION_RESULT.ADD_TO_STORAGE > 0:
self._addChannel(room, byAction=result & ACTION_RESULT.SHOW_ROOM > 0)
elif result & ACTION_RESULT.REMOVE_FROM_STORAGE > 0:
self._removeChannel(room)
action.clear(full=False)
return
示例12: init
def init(self):
client = self.__client
ClientHolder._clearClient()
for (handlerName, listenerName,) in _GLOOX_EVENTS_LISTENERS:
if not hasattr(client, handlerName):
g_logOutput.error(CLIENT_LOG_AREA.PY_WRAPPER, 'Handler no is found', handlerName)
continue
handler = getattr(client, handlerName)
if handler:
g_logOutput.warning(CLIENT_LOG_AREA.PY_WRAPPER, 'Handler already is set', handlerName)
continue
listener = getattr(self, listenerName, None)
if listener is None or not callable(listener):
g_logOutput.error(CLIENT_LOG_AREA.PY_WRAPPER, 'Listener no is found', listenerName)
continue
setattr(client, handlerName, listener)
ClientEventsHandler._setClient(self)
示例13: __doLogin
def __doLogin(self):
client = self.client()
if not client.isConnecting():
g_logOutput.warning(CLIENT_LOG_AREA.LOGIN, 'Client is not connecting', client.getConnectionAddress(), client.getConnectionState())
yield lambda callback: callback(None)
return
g_logOutput.debug(CLIENT_LOG_AREA.TOKEN, 'Sends request to SPA')
response = yield self.__tokenRequester.request()
g_logOutput.debug(CLIENT_LOG_AREA.TOKEN, 'Response is received from SPA', response)
if not response:
g_logOutput.error(CLIENT_LOG_AREA.TOKEN, 'Received chat token is empty')
return
if response.isValid():
if response.getDatabaseID() == getPlayerDatabaseID():
g_logOutput.debug(CLIENT_LOG_AREA.LOGIN, 'Login to XMPP sever')
client.login(response.getCredential())
else:
g_logOutput.error(CLIENT_LOG_AREA.LOGIN, "Player's database ID mismatch", getPlayerDatabaseID())
else:
g_logOutput.warning(CLIENT_LOG_AREA.TOKEN, 'Received chat token is not valid', response)
self.__handleTokenError()
示例14: registerHandler
def registerHandler(self, event, handler):
if event in GLOOX_EVENT.ALL:
handlers = self.__handlers[event]
if handler in handlers:
g_logOutput.warning(CLIENT_LOG_AREA.PY_WRAPPER, 'handler already exists', event, handler)
elif not hasattr(handler, '__self__') or not isinstance(handler.__self__, ClientEventsHandler):
g_logOutput.error(CLIENT_LOG_AREA.PY_WRAPPER, 'Class of handler is not subclass of ClientEventsHandler', handler)
return
if callable(handler):
handlers.add(handler)
else:
g_logOutput.error(CLIENT_LOG_AREA.PY_WRAPPER, 'Handler is invalid', handler)
else:
g_logOutput.error(CLIENT_LOG_AREA.PY_WRAPPER, 'Event is not found', event)
示例15: setClientPresence
def setClientPresence(self, presence):
if presence not in PRESENCE.RANGE:
g_logOutput.error(CLIENT_LOG_AREA.PY_WRAPPER, 'Value of presence is invalid', presence)
return
self.__client.presence = presence