Coverage for python/lsst/log/log/logContinued.py : 44%

Hot-keys on this page
r m x p toggle line displays
j k next/prev highlighted chunk
0 (zero) top of page
1 (one) first highlighted chunk
#!/usr/bin/env python
# # LSST Data Management System # Copyright 2013 LSST Corporation. # # This product includes software developed by the # LSST Project (http://www.lsst.org/). # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation, either version 3 of the License, or # (at your option) any later version. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the LSST License Statement and # the GNU General Public License along with this program. If not, # see <http://www.lsstcorp.org/LegalNotices/>. #
class Log: self._log(Log.TRACE, False, fmt, *args)
self._log(Log.DEBUG, False, fmt, *args)
self._log(Log.INFO, False, fmt, *args)
self._log(Log.WARN, False, fmt, *args)
self._log(Log.ERROR, False, fmt, *args)
self._log(Log.FATAL, False, fmt, *args)
self._log(Log.TRACE, True, fmt, *args, **kwargs)
self._log(Log.DEBUG, True, fmt, *args, **kwargs)
self._log(Log.INFO, True, fmt, *args, **kwargs)
self._log(Log.WARN, True, fmt, *args, **kwargs)
self._log(Log.ERROR, True, fmt, *args, **kwargs)
self._log(Log.FATAL, True, fmt, *args, **kwargs)
if self.isEnabledFor(level): frame = inspect.currentframe().f_back # calling method frame = frame.f_back # original log location filename = os.path.split(frame.f_code.co_filename)[1] funcname = frame.f_code.co_name if use_format: msg = fmt.format(*args, **kwargs) if args or kwargs else fmt else: msg = fmt % args if args else fmt self.logMsg(level, filename, funcname, frame.f_lineno, msg)
# Export static functions from Log class to module namespace
Log.configure(*args)
Log.configure_prop(properties)
return Log.getDefaultLoggerName()
Log.pushContext(name)
Log.popContext()
Log.MDC(key, str(value))
Log.MDCRemove(key)
Log.MDCRegisterInit(func)
Log.getLogger(loggername).setLevel(level)
Log.getLogger(loggername).getLevel()
Log.getLogger(logger).isEnabledFor(level)
Log.getLogger(loggername)._log(level, False, fmt, *args)
Log.getDefaultLogger()._log(TRACE, False, fmt, *args)
Log.getDefaultLogger()._log(DEBUG, False, fmt, *args)
Log.getDefaultLogger()._log(INFO, False, fmt, *args)
Log.getDefaultLogger()._log(WARN, False, fmt, *args)
Log.getDefaultLogger()._log(ERROR, False, fmt, *args)
Log.getDefaultLogger()._log(FATAL, False, fmt, *args)
Log.getLogger(loggername)._log(level, True, fmt, *args, **kwargs)
Log.getDefaultLogger()._log(TRACE, True, fmt, *args, **kwargs)
Log.getDefaultLogger()._log(DEBUG, True, fmt, *args, **kwargs)
Log.getDefaultLogger()._log(INFO, True, fmt, *args, **kwargs)
Log.getDefaultLogger()._log(WARN, True, fmt, *args, **kwargs)
Log.getDefaultLogger()._log(ERROR, True, fmt, *args, **kwargs)
Log.getDefaultLogger()._log(FATAL, True, fmt, *args, **kwargs)
return Log.lwpID
"""Context manager for logging."""
self.name = name self.level = level
self.open() return self
self.close()
self.close()
if self.name is not None: Log.pushContext(self.name) if self.level is not None: Log.getDefaultLogger().setLevel(self.level)
if self.name is not None: Log.popContext() self.name = None
Log.getDefaultLogger().setLevel(level)
return Log.getDefaultLogger().getLevel()
return Log.getDefaultLogger().isEnabledFor(level)
"""Handler for Python logging module that emits to LSST logging."""
self.context = LogContext(name=name, level=level) self.context.open() logging.Handler.__init__(self)
self.close()
if self.context is not None: self.context.close() self.context = None logging.Handler.close(self)
if self.context.isEnabledFor(self.translateLevel(record.levelno)): logging.Handler.handle(self, record)
Log.getLogger(record.name).logMsg(self.translateLevel(record.levelno), record.filename, record.funcName, record.lineno, record.msg % record.args)
""" Translates from standard python logging module levels to standard log4cxx levels. """ return levelno*1000 |