Logging

Since version 0.18.0 rebase-helper uses standard module-level loggers.

There are also 3 loggers with a special purpose:

Logger name Purpose
rebasehelper.traceback traceback generated by unhandled exceptions
rebasehelper.summary messages forming the rebase summary
rebasehelper.report messages forming the textual rebase report (used by text output tool)

rebase-helper uses rebasehelper.logger.CustomLogger logger class which provides extra logging levels.

rebasehelper.logger.LoggerHelper class provides 3 utility methods to manage default handlers:

Examples

# use a single module and get logs from it

import logging

from rebasehelper.specfile import SpecFile

logger = logging.getLogger('rebasehelper.specfile')
logger.addHandler(logging.StreamHandler())

spec = SpecFile('test.spec')
spec.set_release_number(2)
# run a complete rebase with default log handlers

from rebasehelper.logger import LoggerHelper
from rebasehelper.config import Config
from rebasehelper.cli import CLI
from rebasehelper.application import Application

LoggerHelper.create_stream_handlers()
config = Config()
cli = CLI()
config.merge(cli)
exec_dir, res_dir = Application.setup(config)
# default file handlers are automatically created and removed by Application instance,
# unless disabled by passing create_logs=False
app = Application(config, exec_dir, res_dir)
app.run()