本文整理汇总了Python中gamit.log.logger.Logger类的典型用法代码示例。如果您正苦于以下问题:Python Logger类的具体用法?Python Logger怎么用?Python Logger使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Logger类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: onTimeout
def onTimeout(self):
Logger.log("IUserDbLoaduserbasicResponse.onTimeout")
timer = _LoadUserBasicTimer(self, self.dtLmt)
# retry after 10secs
Scheduler.schedule(timer, None, 10, 0)
示例2: getFansByPageIndex
def getFansByPageIndex(self, sessionKey, pageIndex, _request):
"""
:type sessionKey: str
:type pageIndex: int
:type _request: message.gate.ipostoper.IPostOper_Getfansbypageindex_Request
"""
userEntity = UserEntityManager.findUserEntityBySessionKey(sessionKey)
if not userEntity:
ErrorCodeManager.raiseError("ErrorGate_notLoggedInYet")
numPerPage = 100
tb = MongoDatabase.findTableByMessageType(TUserFan)
if not tb:
Logger.log("Table {} not found".format(TUserFan.__name__))
ErrorCodeManager.raiseError("ErrorDb_TableNotFound")
skips = numPerPage * pageIndex
tFanList = tb.findManyWithQuey({TUserFan.fn_myUserId: userEntity.getUserId()},
limit=numPerPage, skip=skips, sort=MongoDatabase.SortByIdDesc)
sFanList = SeqMyFan()
for tFan in tFanList:
userEntity = UserEntityManager.findUserEntityByUserId(tFan.fanUserId)
if not userEntity:
Logger.log("getFansByPageIndex",
"UserNotFound:", tFan.fanUserId)
continue
sFan = SMyFan()
sFan.fanInfo = userEntity.getUserBriefInfo()
sFan.operDt = tFan.createDt
sFanList.append(sFan)
_request.response(sFanList)
示例3: addNewCommentToUserPost
def addNewCommentToUserPost(userEntity, wuPost, interactiveType, content="", mentiondUsers=[], replyComment=False):
"""
:type userEntity: user.userentity.UserEntity
:type wuPost: WUserPost
:type interactiveType: int
:type content: str
:type mentiondUsers: list[str]
:type replyComment: bool
:rtype: str
"""
tComment = TUserPostComment()
tComment.commentId = MyUuid.getUuid()
tComment.interActiveType = interactiveType
tComment.userId = userEntity.getUserId()
tComment.postId = wuPost.getPostId()
tComment.content = content
tComment.mentionedUsers.extend(mentiondUsers)
wuPost.addNewComment(tComment)
DbCacheHelper.getITableSaverProxy().updateTUserPostComment(None, tComment)
DbCacheHelper.getITableSaverProxy().updateTUserPost(None, wuPost.getTUserPost())
hintType = 0
logType = 0
if interactiveType == EInteractiveType.Comment:
if replyComment:
hintType = EHintType.PostCommentReplied
else:
hintType = EHintType.PostCommented
logType = ELogPostOperType.Comment
elif interactiveType == EInteractiveType.Upvote:
hintType = EHintType.PostUpvoted
logType = ELogPostOperType.Upvote
elif interactiveType == EInteractiveType.Shared:
hintType = EHintType.PostReposted
logType = ELogPostOperType.Share
if not hintType:
Logger.log("[PostHelper.addNewCommentToUserPost] Unknown InteractiveType:", interactiveType)
else:
ownerEntity = UserEntityManager.findUserEntityByUserId(wuPost.getOwnerUserId())
if not ownerEntity:
Logger.log("[PostHelper.addNewCommentToUserPost] UserNotFound:", wuPost.getOwnerUserId())
else:
cmtHit = SUserPostCommentHint()
cmtHit.hintType = hintType
cmtHit.operUserInfo = userEntity.getUserBriefInfo()
cmtHit.content = content
cmtHit.postId = wuPost.getPostId()
cmtHit.commentId = tComment.commentId
ownerEntity.addCommentHint(cmtHit)
DbLogHepler.logUserPostOper(userEntity.getLogUserInfo(), wuPost.getPostId(), logType)
return tComment.commentId
示例4: login
def login(self, loginInfo, _request):
"""
:type loginInfo: message.gate.gatemsg.SLogin
:type _request: message.gate.ilogin.ILogin_Login_Request
"""
Logger.log("ILoginImpl.login: ", loginInfo.account)
userEntity = UserEntityManager.findUserEntityByAccount(loginInfo.account)
if not userEntity:
ErrorCodeManager.raiseError("ErrorLogin_InvalidLoginInfo")
if not userEntity.isPasswordValid(loginInfo.password):
ErrorCodeManager.raiseError("ErrorLogin_InvalidLoginInfo")
if not userEntity.isDataLoaded():
userDataView = UserDbHelper.loadUserDataView(userEntity.getUserId())
userEntity.updateUserData(userDataView)
sessionKey = MyUuid.getUuid()
userEntity.updateDeviceCodeAndSessionKey(loginInfo.deviceCode, sessionKey)
UserEntityManager.onUserLogin(userEntity, _request.connId, loginInfo.deviceCode)
loginReturn = userEntity.getLoginReturn()
_request.response(loginReturn)
DbSaver.saveTable(userEntity.getTUserSettings())
DbSaver.saveTable(userEntity.getTUserBasic())
示例5: __initDatabase
def __initDatabase(self, config):
xml = xmlParser.parse(config)
for child in xml.getroot():
tag = child.tag
text = child.text
if tag == 'name':
self.dbname = text
elif tag == 'ip':
self.dbip = text
elif tag == 'port':
self.dbport = int(text)
elif tag == 'username':
self.dbuser = text
elif tag == 'passwd':
self.dbpasswd = text
if not self.dbname:
Logger.logInfo("__Database.__initDatabase", "database name not specified")
return False
if not self.dbip:
self.dbip = "127.0.0.1"
if not self.dbport:
self.dbport = 27017
return True
示例6: getClientInfo
def getClientInfo(self, imgFormat=""):
"""
:rtype: SUserPost
"""
clientInfo = SUserPost()
clientInfo.postId = self.tUserPost.postId
clientInfo.title = self.tUserPost.title
clientInfo.content = self.tUserPost.content
clientInfo.createDt = self.tUserPost.createDt
clientInfo.sharedTimes = self.tUserPost.sharedTimes
clientInfo.commentedTimes = self.tUserPost.commentedTimes
clientInfo.upvotedTimes = self.tUserPost.upvotedTimes
clientInfo.viewTimes = self.tUserPost.viewTimes
userEntity = UserEntityManager.findUserEntityByUserId(self.tUserPost.userId)
if userEntity:
clientInfo.userInfo = userEntity.getUserBriefInfo()
else:
Logger.log("WUserPost.getClientInfo", "UserInfoNotFoundForPost:", self.tUserPost.postId)
for imgKey in self.tUserPost.imageKeys:
imgInfo = ImageHelper.genImageDownloadToken(imgKey, imgFormat)
clientInfo.images.append(imgInfo)
return clientInfo
示例7: updateFamilyMembers
def updateFamilyMembers(self, sessionKey, familyMembers, _request):
"""
:type sessionKey: str
:type familyMembers: list[message.gate.gatemsg.SFamilyMember]
:type _request: IUserInfo_Updatefamilymembers_Request
"""
userEntity = UserEntityManager.findUserEntityBySessionKey(sessionKey)
if not userEntity:
ErrorCodeManager.raiseError("ErrorGate_notLoggedInYet")
indexSet = set()
tfms = SeqTFamilyMember()
for fm in familyMembers:
if fm.index in indexSet:
Logger.log("Duplicated index:", fm.index)
ErrorCodeManager.raiseError("ErrorGate_clientInputError")
if not EGender.isValueValid(fm.gender):
Logger.log("Invalid Gender:", fm.index)
ErrorCodeManager.raiseError("ErrorGate_clientInputError")
tfm = userEntity.updateFamilyMember(fm)
tfms.append(tfm)
DbSaver.saveTableBatch(tfms)
_request.response()
示例8: onMessage
def onMessage(self, connId, payload, isBinary):
Logger.logDebug("WsAcceptor.onMessage", connId)
if connId not in self.connMap:
Logger.logInfo("connId not found")
return
self.rmiServer.onMessage(connId, payload, isBinary)
示例9: getAllMyFocuses
def getAllMyFocuses(self, sessionKey, _request):
"""
:type sessionKey: str
:type _request: message.gate.ipostoper.IPostOper_Getallmyfocuses_Request
"""
userEntity = UserEntityManager.findUserEntityBySessionKey(sessionKey)
if not userEntity:
ErrorCodeManager.raiseError("ErrorGate_notLoggedInYet")
tb = MongoDatabase.findTableByMessageType(TUserFan)
if not tb:
Logger.log("Table {} not found".format(TUserFan.__name__))
ErrorCodeManager.raiseError("ErrorDb_TableNotFound")
tFocusList = tb.findManyWithQuey({TUserFan.fn_fanUserId: userEntity.getUserId()})
sFocusList = SeqMyFocus()
for tFan in tFocusList:
userEntity = UserEntityManager.findUserEntityByUserId(tFan.myUserId)
if not userEntity:
Logger.log("getAllMyFocuses",
"UserNotFound:", tFan.myUserId)
continue
sFocus = SMyFocus()
sFocus.userInfo = userEntity.getUserBriefInfo()
sFocus.operDt = tFan.createDt
sFocusList.append(sFocus)
_request.response(sFocusList)
示例10: raiseError
def raiseError(self, errorName):
if errorName not in self.data:
Logger.log("Unknown Error: " + errorName)
raise Exception(errorName, 0)
config = self.data[errorName]
raise Exception(config.errorStr, config.errorCode)
示例11: unfollowAUser
def unfollowAUser(self, sessionKey, userId, _request):
"""
:type sessionKey: str
:type userId: str
:type _request: message.gate.ipostoper.IPostOper_Unfollowauser_Request
"""
userEntity = UserEntityManager.findUserEntityBySessionKey(sessionKey)
if not userEntity:
ErrorCodeManager.raiseError("ErrorGate_notLoggedInYet")
hisEntity = UserEntityManager.findUserEntityByUserId(userId)
if not hisEntity:
ErrorCodeManager.raiseError("ErrorGate_noSuchUser")
tb = MongoDatabase.findTableByMessageType(TUserFan)
if not tb:
Logger.log("Table {} not found".format(TUserFan.__name__))
ErrorCodeManager.raiseError("ErrorDb_TableNotFound")
fanFound = tb.findOneWithQuery({TUserFan.fn_fanUserId: userEntity.getUserId(), TUserFan.fn_myUserId: userId})
if not fanFound:
ErrorCodeManager.raiseError("ErrorGate_didNotFollowThisUser")
tb.delete({TUserFan.fn_recordId: fanFound.recordId}, delete_one=True)
_request.response()
userEntity.getTUserProperty().focusNum -= 1
hisEntity.getTUserProperty().fanNum -= 1
DbSaver.saveTable(userEntity.getTUserProperty())
DbSaver.saveTable(hisEntity.getTUserProperty())
示例12: deleteFromTableBatch
def deleteFromTableBatch(cls, tableType, filter):
tb = MongoDatabase.findTableByMessageType(tableType)
if not tb:
Logger.log("DbSaver.delteFromTable. Table not found:", tableType.__name__)
return
tb.delete(filter, delete_one=False)
示例13: saveTable
def saveTable(cls, data):
tb = MongoDatabase.findTableByMessageObj(data)
if not tb:
Logger.log("DbSaver.saveTable. Table not found:", data.__class__.__name__)
return
tb.update(data)
示例14: addNewSysTopicTest
def addNewSysTopicTest():
imageList = []
imageList.append("/Users/mahanzhou/Development/wechat_materials/2015.09.05/004.jpg")
imageList.append("/Users/mahanzhou/Development/wechat_materials/2015.09.05/005.jpg")
imageList.append("/Users/mahanzhou/Development/wechat_materials/2015.09.05/003.jpg")
Logger.log("Getting Image Upload Tokens...")
ProxyHelper.getIPostOperProxy().getImageUploadTokens(GetImageUploadTokensResponse(imageList), "", len(imageList))
示例15: loadAllUserBasics
def loadAllUserBasics(self):
if self.dictUserIdUser:
return
allUserBasics = UserDbHelper.loadAllUserBasics()
self.addUserBasics(allUserBasics)
Logger.log("Num of User Loaded:", len(allUserBasics))