def follow_log(module, le_path, logs, name=None, logtype=None):
 followed_count = 0
 for log in logs:
  if query_log_status(module, le_path, log):
   continue
  if module.check_mode:
   module.exit_json(changed=True)
  cmd = [le_path, 'follow', log]
  if name:
   cmd.extend(['--name', name])
  if logtype:
   cmd.extend(['--type', logtype])
  (rc, out, err) = module.run_command(' '.join(cmd))
  if (not query_log_status(module, le_path, log)):
   module.fail_json(msg=("failed to follow '%s': %s" % (log, err.strip())))
  followed_count += 1
 if (followed_count > 0):
  module.exit_json(changed=True, msg=('followed %d log(s)' % (followed_count,)))
 module.exit_json(changed=False, msg='logs(s) already followed')

def follow_log ( module , le_path , logs , name = None , logtype = None ) : followed_count = 0 for log in logs : if query_log_status ( module , le_path , log ) : continue if module . check_mode : module . exit_json ( changed = True ) cmd = [ le_path , 'follow' , log ] if name : cmd . extend ( [ '--name' , name ] ) if logtype : cmd . extend ( [ '--type' , logtype ] ) ( rc , out , err ) = module . run_command ( ' ' . join ( cmd ) ) if ( not query_log_status ( module , le_path , log ) ) : module . fail_json ( msg = ( "failed to follow '%s': %s" % ( log , err . strip ( ) ) ) ) followed_count += 1 if ( followed_count > 0 ) : module . exit_json ( changed = True , msg = ( 'followed %d log(s)' % ( followed_count , ) ) ) module . exit_json ( changed = False , msg = 'logs(s) already followed' )
follows one or more logs if not already followed .