From 19d7197d971b774bf0082067abe2acee1460461c Mon Sep 17 00:00:00 2001 From: Nathaniel Case Date: Mon, 7 Jan 2019 15:46:31 -0500 Subject: [PATCH] Copy detailed logging to persistent.py so local can benefit, too. (#50614) --- lib/ansible/plugins/connection/persistent.py | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/lib/ansible/plugins/connection/persistent.py b/lib/ansible/plugins/connection/persistent.py index 943c470003b..4f08a4c67ba 100644 --- a/lib/ansible/plugins/connection/persistent.py +++ b/lib/ansible/plugins/connection/persistent.py @@ -133,8 +133,16 @@ class Connection(ConnectionBase): result = {'error': to_text(stderr, errors='surrogate_then_replace')} if 'messages' in result: - for msg in result.get('messages'): - display.vvvv('%s' % msg, host=self._play_context.remote_addr) + for level, message in result['messages']: + if level == 'log': + display.display(message, log_only=True) + elif level in ('debug', 'v', 'vv', 'vvv', 'vvvv', 'vvvvv', 'vvvvvv'): + getattr(display, level)(message, host=self._play_context.remote_addr) + else: + if hasattr(display, level): + getattr(display, level)(message) + else: + display.vvvv(message, host=self._play_context.remote_addr) if 'error' in result: if self._play_context.verbosity > 2: