def get_logger(section, filename='altwfc.cfg'): """Return the logger of the corresponding section.""" config = ConfigParser.RawConfigParser(allow_no_value=True) config.read(get_config_filename(filename)) return utils.create_logger( config.get(section, 'LoggerName'), config.get(section, 'LoggerFilename'), config.getint(section, 'LoggerLevel'), config.getboolean(section, 'LoggerOutputConsole'), config.getboolean(section, 'LoggerOutputFile') )
from multiprocessing import freeze_support import other.utils as utils class TokenType: UNKNOWN = 0 FIELD = 1 STRING = 2 NUMBER = 3 TOKEN = 4 # Logger settings logger_output_to_console = True logger_output_to_file = True logger_name = "GamespyBackendServer" logger_filename = "gamespy_backend_server.log" logger = utils.create_logger(logger_name, logger_filename, -1, logger_output_to_console, logger_output_to_file) class GameSpyServerDatabase(BaseManager): pass class GameSpyBackendServer(object): def __init__(self): self.server_list = {} self.natneg_list = {} GameSpyServerDatabase.register("get_server_list", callable=lambda:self.server_list) GameSpyServerDatabase.register("find_servers", callable=self.find_servers) GameSpyServerDatabase.register("find_server_by_address", callable=self.find_server_by_address) GameSpyServerDatabase.register("find_server_by_local_address", callable=self.find_server_by_local_address) GameSpyServerDatabase.register("update_server_list", callable=self.update_server_list) GameSpyServerDatabase.register("delete_server", callable=self.delete_server)
import BaseHTTPServer import cgi import urlparse import sqlite3 import xml.dom.minidom as minidom import other.utils as utils import gamespy.gs_database as gs_database from io import BytesIO logger_output_to_console = True logger_output_to_file = True logger_name = "StorageServer" logger_filename = "storage_server.log" logger = utils.create_logger(logger_name, logger_filename, -1, logger_output_to_console, logger_output_to_file) # Paths to ProxyPass: /SakeStorageServer, /SakeFileServer, /RaceService address = ("0.0.0.0", 8000) def escape_xml(s): s = s.replace("&", "&") s = s.replace('"', """) s = s.replace("'", "'") s = s.replace("<", "<") s = s.replace(">", ">") return s class StorageServer(object):