Ejemplo n.º 1
0
def main():
    global pp_global_info, printer

    pp_dns_init()

    if pp_redis_init() != True:
        return

    fd_channel_init()

    get_channel_init()

    sleep(1)

    print('worker [%d] started' % redis_dbid)
    pp_global_info.event_gameover.wait()
    print('worker [%d] stopping' % redis_dbid)

    sleep(60)
    printer.wait_for_flush()
    logger.wait_for_flush()
Ejemplo n.º 2
0
        def record(self, log, bin=False):
                if self.log_level > self.dict_log_level['record']: return
                time = datetime.strftime(datetime.now(), '%Y-%m-%d %H:%M:%S.%f')
                if bin == True:
                        self.redis_sender.put(('log_record', dumps((time, log),0)))
                else:
                        self.redis_sender.put(('log_record', (time, str(log))))

        def wait_for_flush(self):
                self.redis_sender.wait_for_flush()

#-----------------------------------------------------------------------------------------

printer = redis_logger()

#================================ for test ===============================================

if __name__ == "__main__":
        from pp_baseredis  import pp_redis_init
        pp_redis_init()
        printer.debug('test logger debug')
        printer.info('test logger info')
        printer.warning('test logger warning')
        printer.error('test logger error')
        printer.critical('test logger critical')
        printer.data('test logger data')
        printer.time('test logger time')
        printer.record('test logger record')
        printer.wait_for_flush()

Ejemplo n.º 3
0
 def __init__(self, dbid):
     self.dbid = dbid
     self.pp_redis = pp_redis_init(dbid)
Ejemplo n.º 4
0
def main():
        pp_dns_init()
        pp_redis_init()
        fd_channel_init()
        pp_global_info.event_gameover.wait()