diff options
author | Petr Viktorin <pviktori@redhat.com> | 2013-05-24 12:17:51 +0200 |
---|---|---|
committer | Martin Kosek <mkosek@redhat.com> | 2013-06-17 19:23:04 +0200 |
commit | 780961a6433830a5928e1785460a2755e498639d (patch) | |
tree | 897a27f70b6ca1ea255edcd03d267e28e1d67003 /ipapython/log_manager.py | |
parent | e87807d3797ad8154b78b8741a4541326c9ca12f (diff) | |
download | freeipa-780961a6433830a5928e1785460a2755e498639d.tar.gz freeipa-780961a6433830a5928e1785460a2755e498639d.tar.xz freeipa-780961a6433830a5928e1785460a2755e498639d.zip |
Add Nose plugin for BeakerLib integration
The plugin hooks into the Nose runner and IPA's logging infrastructure
and calls the appropriate BeakerLib functions (rl*).
IPA's log_manager is extended to accept custom Handler classes.
The ipa-run-tests helper now loads the plugin.
Patr of the work for: https://fedorahosted.org/freeipa/ticket/3621
Diffstat (limited to 'ipapython/log_manager.py')
-rw-r--r-- | ipapython/log_manager.py | 19 |
1 files changed, 13 insertions, 6 deletions
diff --git a/ipapython/log_manager.py b/ipapython/log_manager.py index 21e41060a..9625bdfb7 100644 --- a/ipapython/log_manager.py +++ b/ipapython/log_manager.py @@ -1006,6 +1006,9 @@ class LogManager(object): Specifies that a FileHandler be created, using the specified filename. + log_handler + Specifies a custom logging.Handler to use + Common keys: ------------ @@ -1140,8 +1143,10 @@ class LogManager(object): # Iterate over handler configurations. for cfg in configs: - # File or stream handler? + # Type of handler? filename = cfg.get('filename') + stream = cfg.get("stream") + log_handler = cfg.get("log_handler") if filename: if cfg.has_key("stream"): raise ValueError("both filename and stream are specified, must be one or the other, config: %s" % cfg) @@ -1188,11 +1193,7 @@ class LogManager(object): permission = cfg.get('permission') if permission is not None: os.chmod(path, permission) - else: - stream = cfg.get("stream") - if stream is None: - raise ValueError("neither file nor stream specified in config: %s" % cfg) - + elif stream: handler = logging.StreamHandler(stream) # Set the handler name @@ -1200,6 +1201,12 @@ class LogManager(object): if name is None: name = 'stream:%s' % (stream) handler.name = name + elif log_handler: + handler = log_handler + else: + raise ValueError( + "neither file nor stream nor log_handler specified in " + "config: %s" % cfg) # Add the handler handlers.append(handler) |