def on_start(self): if config.getboolean('Other', 'log_network_packets'): import os import tempfile logfile = os.path.join(tempfile.gettempdir(), "netlog.txt") netlog.setLevel(logging.INFO) fh = logging.FileHandler(logfile, mode="w") fmt = logging.Formatter("[%(asctime)s] %(message)s", datefmt="%Y-%m-%d %H:%M:%S") fh.setFormatter(fmt) netlog.addHandler(fh) monsterdb.read_monster_db() itemdb.load_itemdb('itemdb.txt') dbgh = DebugLogHandler(self) dbgh.setFormatter( logging.Formatter("[%(asctime)s] %(message)s", datefmt="%H:%M")) debuglog.addHandler(dbgh) debuglog.setLevel(logging.INFO) net2 = DebugLogHandler(self) net2.setFormatter( logging.Formatter("[%(asctime)s] %(message)s", datefmt="%H:%M")) net2.setLevel(logging.ERROR) netlog.addHandler(net2) plugins.load_plugins(config) handlers.app = self import chat chat.pp_actions = () # self.reconnect() Clock.schedule_once(self.update_online_list, 0.2) Clock.schedule_interval(self.update_online_list, 35) Clock.schedule_interval(self.update_loop, 0) Clock.schedule_once(self.show_menu, 1.5)
def on_start(self): if config.getboolean('Other', 'log_network_packets'): import os import tempfile logfile = os.path.join(tempfile.gettempdir(), "netlog.txt") netlog.setLevel(logging.INFO) fh = logging.FileHandler(logfile, mode="w") fmt = logging.Formatter("[%(asctime)s] %(message)s", datefmt="%Y-%m-%d %H:%M:%S") fh.setFormatter(fmt) netlog.addHandler(fh) monsterdb.read_monster_db() itemdb.load_itemdb('itemdb.txt') dbgh = DebugLogHandler(self) dbgh.setFormatter(logging.Formatter("[%(asctime)s] %(message)s", datefmt="%H:%M")) debuglog.addHandler(dbgh) debuglog.setLevel(logging.INFO) net2 = DebugLogHandler(self) net2.setFormatter(logging.Formatter("[%(asctime)s] %(message)s", datefmt="%H:%M")) net2.setLevel(logging.ERROR) netlog.addHandler(net2) plugins.load_plugins(config) handlers.app = self # self.reconnect() Clock.schedule_once(self.update_online_list, 0.2) Clock.schedule_interval(self.update_online_list, 35) Clock.schedule_interval(self.update_loop, 0) Clock.schedule_once(self.show_menu, 1.5)
def on_start(self): if config.getboolean('Other', 'log_network_packets'): import os import tempfile logfile = os.path.join(tempfile.gettempdir(), "netlog.txt") netlog.setLevel(logging.INFO) fh = logging.FileHandler(logfile, mode="w") fmt = logging.Formatter("[%(asctime)s] %(message)s", datefmt="%Y-%m-%d %H:%M:%S") fh.setFormatter(fmt) netlog.addHandler(fh) monsterdb.read_monster_db() dbgh = DebugLogHandler(self) dbgh.setFormatter(logging.Formatter("[%(asctime)s] %(message)s", datefmt="%H:%M")) debuglog.addHandler(dbgh) debuglog.setLevel(logging.INFO) plugins.load_plugins(config, 'chatlogfile') handlers.app = self net.login(host=config.get('Server', 'host'), port=config.getint('Server', 'port'), username=config.get('Player', 'username'), password=config.get('Player', 'password'), charname=config.get('Player', 'charname')) self.root.map_w.tile_size = config.getint('GUI', 'tile_size') Clock.schedule_once(self.update_online_list, 0.2) Clock.schedule_interval(self.update_online_list, 35) Clock.schedule_interval(self.update_loop, 0)
def emit(self, record): msg = self.format(record) cui.chatlog_append(msg) if __name__ == "__main__": config = ConfigParser() config.read('../manachat.ini') rootLogger = logging.getLogger('') rootLogger.addHandler(logging.NullHandler()) dbgh = CursesDebugLogHandler() dbgh.setFormatter(logging.Formatter("[%(asctime)s] %(message)s", datefmt="%H:%M")) debuglog.addHandler(dbgh) debuglog.setLevel(logging.INFO) fh = logging.FileHandler("/tmp/netlog.txt", mode="w") fh.setFormatter(logging.Formatter("[%(asctime)s] %(message)s", datefmt="%Y-%m-%d %H:%M:%S")) netlog.addHandler(fh) netlog.setLevel(logging.INFO) cui.init() plugin_list = config.get('Core', 'plugins').split() plugins.load_plugins(config, *plugin_list) monsterdb.read_monster_db('../monsterdb.txt') itemdb.load_itemdb('../itemdb.txt')
if data.code == 0: if len(readline.get_line_buffer()) == 0: last_nick = mapserv.last_whisper['to'] readline.insert_text('/w "{}" '.format(last_nick)) readline.redisplay() if __name__ == '__main__': rootLogger = logging.getLogger('') rootLogger.addHandler(logging.NullHandler()) dbgh = DebugLogHandler() dbgh.setFormatter( logging.Formatter("[%(asctime)s] %(message)s", datefmt="%Y-%m-%d %H:%M:%S")) debuglog.addHandler(dbgh) debuglog.setLevel(logging.INFO) config = ConfigParser() config.read('manachat.ini') if config.getboolean('Other', 'log_network_packets'): from loggers import netlog netlog.setLevel(logging.INFO) fh = logging.FileHandler('/tmp/netlog.txt', mode="w") fmt = logging.Formatter("[%(asctime)s] %(message)s", datefmt="%Y-%m-%d %H:%M:%S") fh.setFormatter(fmt) netlog.addHandler(fh) load_itemdb('itemdb.txt')