class LogProxy(object): '''Proxies log entries to another log keeper.''' implements(ILogKeeper) def __init__(self, logkeeper): self._logkeeper = ILogKeeper(logkeeper) def do_log(self, level, object, category, format, args, depth=2, file_path=None, line_num=None): self._logkeeper.do_log(level, object, category, format, args, depth=depth+1, file_path=file_path, line_num=line_num) def redirect_log(self, logkeeper): self._logkeeper = ILogKeeper(logkeeper)
def dump(self, logkeeper): logkeeper = ILogKeeper(logkeeper) for line in self._buffer: logkeeper.do_log(*line)