本文整理汇总了Python中gamit.log.logger.Logger.log方法的典型用法代码示例。如果您正苦于以下问题:Python Logger.log方法的具体用法?Python Logger.log怎么用?Python Logger.log使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类gamit.log.logger.Logger
的用法示例。
在下文中一共展示了Logger.log方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: addNewCommentToUserPost
# 需要导入模块: from gamit.log.logger import Logger [as 别名]
# 或者: from gamit.log.logger.Logger import log [as 别名]
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
示例2: onTimeout
# 需要导入模块: from gamit.log.logger import Logger [as 别名]
# 或者: from gamit.log.logger.Logger import log [as 别名]
def onTimeout(self):
Logger.log("IUserDbLoaduserbasicResponse.onTimeout")
timer = _LoadUserBasicTimer(self, self.dtLmt)
# retry after 10secs
Scheduler.schedule(timer, None, 10, 0)
示例3: login
# 需要导入模块: from gamit.log.logger import Logger [as 别名]
# 或者: from gamit.log.logger.Logger import log [as 别名]
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())
示例4: getClientInfo
# 需要导入模块: from gamit.log.logger import Logger [as 别名]
# 或者: from gamit.log.logger.Logger import log [as 别名]
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
示例5: getAllMyFocuses
# 需要导入模块: from gamit.log.logger import Logger [as 别名]
# 或者: from gamit.log.logger.Logger import log [as 别名]
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)
示例6: updateFamilyMembers
# 需要导入模块: from gamit.log.logger import Logger [as 别名]
# 或者: from gamit.log.logger.Logger import log [as 别名]
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()
示例7: getFansByPageIndex
# 需要导入模块: from gamit.log.logger import Logger [as 别名]
# 或者: from gamit.log.logger.Logger import log [as 别名]
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)
示例8: unfollowAUser
# 需要导入模块: from gamit.log.logger import Logger [as 别名]
# 或者: from gamit.log.logger.Logger import log [as 别名]
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())
示例9: raiseError
# 需要导入模块: from gamit.log.logger import Logger [as 别名]
# 或者: from gamit.log.logger.Logger import log [as 别名]
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)
示例10: addNewSysTopicTest
# 需要导入模块: from gamit.log.logger import Logger [as 别名]
# 或者: from gamit.log.logger.Logger import log [as 别名]
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))
示例11: deleteFromTableBatch
# 需要导入模块: from gamit.log.logger import Logger [as 别名]
# 或者: from gamit.log.logger.Logger import log [as 别名]
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)
示例12: saveTable
# 需要导入模块: from gamit.log.logger import Logger [as 别名]
# 或者: from gamit.log.logger.Logger import log [as 别名]
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)
示例13: loadAllUserBasics
# 需要导入模块: from gamit.log.logger import Logger [as 别名]
# 或者: from gamit.log.logger.Logger import log [as 别名]
def loadAllUserBasics(self):
if self.dictUserIdUser:
return
allUserBasics = UserDbHelper.loadAllUserBasics()
self.addUserBasics(allUserBasics)
Logger.log("Num of User Loaded:", len(allUserBasics))
示例14: send
# 需要导入模块: from gamit.log.logger import Logger [as 别名]
# 或者: from gamit.log.logger.Logger import log [as 别名]
def send(self, connId, payload, isBinary):
if connId not in self.connMap:
return
conn = self.connMap[connId]
try:
conn.sendMessage(payload, isBinary)
except Exception as ex:
Logger.log("[WsAcceptor.send]", ex)
示例15: getUserPostListByUserId
# 需要导入模块: from gamit.log.logger import Logger [as 别名]
# 或者: from gamit.log.logger.Logger import log [as 别名]
def getUserPostListByUserId(self, userId, dtThreshold, targetNum, imgForat, userPostNum):
"""
:type userId: str
:type targetNum: int
:type imgForat: str
:type userPostNum: int
:rtype: list[SUserPost]
"""
targetNum = targetNum if (targetNum <= self.maxTargetNum) else self.maxTargetNum
oldestDt = dtThreshold
resPostList = SeqUserPost()
if not userPostNum:
return resPostList
cachedPostIdList = []
if userId in self.userPostIdMap:
cachedPostIdList = self.userPostIdMap[userId]
for postId in cachedPostIdList:
if postId not in self.postMap:
Logger.log("getUserPostListByUserId. PostId not found in postMap")
continue
wuPost = self.postMap[postId]
if wuPost.getCreateDt() < dtThreshold:
resPostList.append(wuPost.getClientInfo(imgForat))
if oldestDt > wuPost.getCreateDt():
oldestDt = wuPost.getCreateDt()
if len(resPostList) >= targetNum:
break
if len(resPostList) >= targetNum:
return resPostList
if len(cachedPostIdList) >= userPostNum:
return resPostList
limit = targetNum - len(resPostList)
tPostList = []
tb = MongoDatabase.findTableByMessageType(TUserPost)
if tb:
query = {TUserPost.fn_userId: userId,
TUserPost.fn_createDt: {"$lt": oldestDt}}
tPostList = tb.findManyWithQuey(query, limit=limit, sort=MongoDatabase.SortByIdDesc)
for tPost in tPostList:
wuPost = WUserPost(tPost)
resPostList.append(wuPost.getClientInfo(imgForat))
return resPostList