本文整理汇总了Python中sgLib.core.Gcore.getLogger方法的典型用法代码示例。如果您正苦于以下问题:Python Gcore.getLogger方法的具体用法?Python Gcore.getLogger怎么用?Python Gcore.getLogger使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类sgLib.core.Gcore
的用法示例。
在下文中一共展示了Gcore.getLogger方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: _getMissionCache
# 需要导入模块: from sgLib.core import Gcore [as 别名]
# 或者: from sgLib.core.Gcore import getLogger [as 别名]
def _getMissionCache(self,action=''):
'''获取任务缓存'''
activeMission = Gcore.getUserData(self.uid,'ActiveMission')#缓存查询
if (activeMission is None) or (not isinstance(activeMission,dict)):
myLog = Gcore.getLogger('zhanggh','mission')
myLog.error("任务缓存有异常,UserId:%s,动作:%s,用户缓存内容:"%(self.uid,action))
myLog.error( Gcore.StorageUser.get(self.uid))
activeMission = self.db.out_rows('tb_mission',['MissionId','GetValue'],'UserId=%s AND Status in (1,2)'%self.uid)
activeMission = {k['MissionId']:k for k in activeMission}
Gcore.setUserData(self.uid,{'ActiveMission':activeMission})
return activeMission
示例2: _getAchieveCache
# 需要导入模块: from sgLib.core import Gcore [as 别名]
# 或者: from sgLib.core.Gcore import getLogger [as 别名]
def _getAchieveCache(self,action=''):
'''获取成就缓存'''
activeAchieve = Gcore.getUserData(self.uid, 'ActiveAchieve')#缓存活跃成就
if (activeAchieve is None) or (not isinstance(activeAchieve,list or tuple)):
myLog = Gcore.getLogger('zhanggh','achieve')
myLog.error("成就缓存有异常,UserId:%s,动作:%s,用户缓存内容:"%(self.uid,action))
myLog.error( Gcore.StorageUser.get(self.uid))
activeAchieve = self.getAchievements()
activeAchieve = [k for k in activeAchieve if activeAchieve[k]['Finished']==0]
Gcore.setUserData(self.uid,{'ActiveAchieve':activeAchieve})
return activeAchieve
示例3: signal_handle
# 需要导入模块: from sgLib.core import Gcore [as 别名]
# 或者: from sgLib.core.Gcore import getLogger [as 别名]
def signal_handle(sign_num, frame):
import signal
logger = Gcore.getLogger('system', 'server')
if sign_num == signal.SIGBUS:
server.stop(180)
logger.warning('I got a signal.SIGBUS server stop')
sys.exit(-1)
elif sign_num == signal.SIGTERM:
server.stop(180)
logger.warning('I got a signal.SIGTERM server stop')
elif sign_num == signal.SIGHUP:
logger.warning('I got a signal.SIGHUP pass')
pass
elif sign_num == signal.SIGUSR1: #用户发送停止服务的指令 10
logger.warning('I got a signal.SIGUSR1 going to stop server')
server.stop(180)
elif sign_num == signal.SIGUSR2: # 12
Gcore.reload()
logger.warning('I got a signal.SIGUSR2, Gcore reload()')
示例4: main
# 需要导入模块: from sgLib.core import Gcore [as 别名]
# 或者: from sgLib.core.Gcore import getLogger [as 别名]
def main():
port = Setting.getGatewayPort()
if not port:
port = Cfg.CFG_BATTLESERV_PORT
_pool = gevent.pool.Pool()
service = Service()
server = Server(('0.0.0.0', int(port) ), handle=service.handle, spawn=_pool.spawn)
#===========================================================
import signal
logger = Gcore.getLogger('server', 'server')
def close_server():
logger.warning('I got a signal.SIGUSR1 going to stop server')
server.stop(180)
def reload_server():
Gcore.reload()
logger.warning('I got a signal.SIGUSR2, Gcore reload()')
def hook_signal():
'''捕获信号'''
if os.name == 'nt':
return
#信号10-关服
gevent.signal(signal.SIGUSR1, close_server)
#信号12-重载
gevent.signal(signal.SIGUSR2, reload_server)
hook_signal()
#=====================================================================
message.sub(Server.NEW_CONNECTION, service.new_connection)
message.sub(Server.LOST_CONNECTION, service.lost_connection)
app = Application(server)
print '=' * 50
print '=', ' '*15, 'Server Started', ' '*15, '='
print '=' * 50
app.run()
if pid_file:
with open(pid_file, 'wb') as fd:
fd.write('0')