Exemple #1
0
def setup():

    global LEVELS, LOG_FILENAME

    # Get log level from config
    config_level = config.get("Logging", "verboseness")
    level = LEVELS.get(config_level, logging.NOTSET)

    # Setup config
    base = logging.getLogger()
    base.setLevel(level)

    # Setup formatting
    logging._defaultFormatter = formatter = logging.Formatter("%(asctime)s %(levelname)-8s %(name)s - %(message)s")

    # Get log types from config
    if config.getBool("Logging", "to_file"):
        handler = logging.FileHandler(LOG_FILENAME, "w")
        handler.setFormatter(formatter)
        base.addHandler(handler)

    if config.getBool("Logging", "to_terminal"):
        handler = logging.StreamHandler()
        handler.setFormatter(formatter)
        base.addHandler(handler)

    base.debug("Logging set up")
Exemple #2
0
	def __init__(self,config):
		pygame.init()
		mode = 0
		mode |= pygame.FULLSCREEN if config.getBool("screen/fullscreen",False) else 0
		mode |= pygame.NOFRAME if not config.getBool("screen/showFrame",True) else 0
		info = pygame.display.Info()
		width = config.getInt("screen/width",info.current_w)
		height = config.getInt("screen/height",info.current_h)
		self.screen = pygame.display.set_mode((width,height),mode,32)
		self.clock = pygame.time.Clock()
		self.display = ui.Display(config,self.screen)
		self.controls = controls.Controls()
		pygame.display.set_caption("WeekendUI")