예제 #1
0
 def singletonConfigTest( self ):
     c = getConfig( self.arglist )
     d = getConfig()
     self.assertEqual( c, d )
예제 #2
0
 def purgeSingletonTest( self ):
     c = getConfig( self.arglist )
     purgeConfig()
     d = getConfig( self.arglist )
     self.assertNotEqual( c, d )
예제 #3
0
파일: peapod.py 프로젝트: huwlynes/peapod
          filename of each new podcast"
    print "--export \t\t\tprints feeds in OPML"


if __name__ == "__main__":
    # create an initial LOGGER.  Messages to the 
    # screen should be warnings or higher.
    LOGGER = logging.getLogger()
    CONSOLE = logging.StreamHandler()
    CONSOLE.setLevel(logging.WARN)
    LOGGER.addHandler(CONSOLE)

    # load the config & check for commandline options
    ARGS = parse_commandline()
    try:
        CONFIG = getConfig(ARGS)
    except:
        LOGGER.critical("Error generating configuration object")
        sys.exit(-1)

    # build file handler with configured level
    FH = logging.FileHandler(os.path.sep.join((CONFIG.options["homedir"], 
                                              "log")))
    FH.setLevel( CONFIG.options["log_level"] )
    FORMAT = logging.Formatter("%(asctime)s %(levelname)s \
                               %(name)s %(message)s")
    FH.setFormatter(FORMAT)
    LOGGER.addHandler(FH)

    # the LOGGER must be capable of catching the lowest desired log level.
    LOGGER.setLevel(CONFIG.options["log_level"])