task logging revamp

* allow global no_log setting, no need to set at play or task level, but can be overriden by them
 * allow turning off syslog only on task execution from target host (manage_syslog), overlaps with no_log functionality
 * created log function for task modules to use, now we can remove all syslog references, will use systemd journal if present
 * added debug flag to modules, so they can make it call new log function conditionally
 * added debug logging in module's run_command
This commit is contained in:
Brian Coca 2015-09-25 23:57:03 -04:00
parent b757798f3e
commit 37a918438b
6 changed files with 79 additions and 45 deletions

View file

@ -206,9 +206,6 @@ class PlayContext(Base):
if play.become_user:
self.become_user = play.become_user
# non connection related
self.no_log = play.no_log
if play.force_handlers is not None:
self.force_handlers = play.force_handlers
@ -234,8 +231,6 @@ class PlayContext(Base):
# general flags (should we move out?)
if options.verbosity:
self.verbosity = options.verbosity
#if options.no_log:
# self.no_log = boolean(options.no_log)
if options.check:
self.check_mode = boolean(options.check)
if hasattr(options, 'force_handlers') and options.force_handlers:
@ -322,6 +317,10 @@ class PlayContext(Base):
if task._local_action:
setattr(new_info, 'connection', 'local')
# set no_log to default if it was not previouslly set
if new_info.no_log is None:
new_info.no_log = C.DEFAULT_NO_LOG
return new_info
def make_become_cmd(self, cmd, executable=None):