예제 #1
0
파일: _setup.py 프로젝트: niktre/espressopp
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()
예제 #2
0
파일: _setup.py 프로젝트: xzhh/espressopp
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()
예제 #3
0
파일: _setup.py 프로젝트: niktre/espressopp
 def __my_setLevel(self, level):
     __orig_setLevel(self, level)
     _espressopp.setLogger(self)
예제 #4
0
파일: _setup.py 프로젝트: xzhh/espressopp
 def my_setLevel(self, level):
     __orig_setLevel(self, level)
     _espressopp.setLogger(self)