Пример #1
0
    def __init__(self, **kwargs):
        # if you need to call the superclass constructor:
        # super().__init__(**kwargs) # python3
        # super(FancyHelloWorld, self).__init__(**kwargs) # python2 compatible

        self.pre = self.__class__.__name__  # auxiliary string for debugging output
        # check kwargs agains parameter_defs, attach ok'd parameters to this
        # object as attributes
        parameterInitCheck(self.parameter_defs, kwargs, self)
        self.logger = getLogger(self.pre)  # hierarchical logger
        self.logger.debug("__init__ : hello")
Пример #2
0
def set_logging(command, options, config):
    for key in config.keys():
        if "logger_" in key:
            pars = config[key]
            qualname = pars["qualname"]
            levelstr = pars["level"]
            level = getattr(logging, levelstr)
            # logger = logging.getLogger(qualname)
            getLogger(qualname)
            confLogger(logger, level)

    ## now, anywhere in your code, do this:
    logger = logging.getLogger("skeleton")
    logger.debug("debug")
    logger.info("info")

    l = config["DEFAULT"]
    logger.info("ServerAliveInterval %s", l["ServerAliveInterval"])

    ## could chain more config / option handling here
    ## next, proceed to the actual entry point of your app
    app(command, options, config)
Пример #3
0
 def __init__(self, **kwargs):
     self.pre = self.__class__.__name__  # auxiliary string for debugging output
     parameterInitCheck(self.parameter_defs, kwargs,
                        self)  # check for input parameters
     self.logger = getLogger(self.pre)  # hierarchical logger
     self.logger.debug("__init__ : hello")