Example #1
0
def _setupLogging():
    import logging, os, math

    logConfigFile = "espressopp_log.conf"
    if os.path.exists(logConfigFile):
        import logging.config

        logging.config.fileConfig(logConfigFile)
        log = logging.getLogger("root")
        log.info("Reading log config file %s", logConfigFile)
    else:
        logging.basicConfig(
            format="%(process)d %(asctime)s %(name)s (%(filename)s::%(lineno)s,%(funcName)s) %(levelname)s: %(message)s"
        )
        log = logging.getLogger("root")
        log.info("Did not find log config file %s, using basic configuration.", logConfigFile)

        # This initialization routine will change existing and future loggers
        # to make a connection with their Python logger and change their class

        def __my_setLevel(self, level):
            __orig_setLevel(self, level)
            _espressopp.setLogger(self)

        __orig_setLevel = logging.Logger.setLevel
        logging.Logger.setLevel = __my_setLevel
        logging.TRACE = int((logging.NOTSET + logging.DEBUG) / 2.0)
        logging.addLevelName("TRACE", logging.TRACE)
        _espressopp.setLogger()
Example #2
0
def _setupLogging():
    logConfigFile = "espressopp_log.conf"
    if os.path.exists(logConfigFile):
        logging.config.fileConfig(logConfigFile)
        log = logging.getLogger('root')
        log.info('Reading log config file %s', logConfigFile)
    else:
        logging.basicConfig(
            format=
            "%(process)d %(asctime)s %(name)s (%(filename)s::%(lineno)s,%(funcName)s) %(levelname)s: %(message)s"
        )
        log = logging.getLogger('root')
        log.info('Did not find log config file %s, using basic configuration.',
                 logConfigFile)

        # This initialization routine will change existing and future loggers
        # to make a connection with their Python logger and change their class

        __orig_setLevel = logging.Logger.setLevel

        def my_setLevel(self, level):
            __orig_setLevel(self, level)
            _espressopp.setLogger(self)

        logging.Logger.setLevel = my_setLevel
        logging.TRACE = int((logging.NOTSET + logging.DEBUG) / 2.0)
        logging.addLevelName('TRACE', logging.TRACE)
        _espressopp.setLogger()
Example #3
0
 def __my_setLevel(self, level):
     __orig_setLevel(self, level)
     _espressopp.setLogger(self)
Example #4
0
 def my_setLevel(self, level):
     __orig_setLevel(self, level)
     _espressopp.setLogger(self)