displaly. log, handle when caplevel is already taken care of (#82227)

reneables ansible logging
pull/82225/head
Brian Coca 1 year ago committed by GitHub
parent f8cdec6324
commit f6d7dd0840
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -420,9 +420,9 @@ class Display(metaclass=Singleton):
self._log(nocolor, color)
@proxy_display
def _log(self, msg: str, color: str | None = None, caplevel: int = 0):
def _log(self, msg: str, color: str | None = None, caplevel: int | None = None):
if self.log_verbosity > caplevel:
if caplevel is None or self.log_verbosity > caplevel:
msg2 = msg.lstrip('\n')
lvl = logging.INFO

@ -0,0 +1,2 @@
shippable/posix/group4
context/controller

@ -0,0 +1,4 @@
- hosts: localhost
gather_facts: false
tasks:
- ping:

@ -0,0 +1,12 @@
#!/usr/bin/env bash
set -eux
ALOG=${OUTPUT_DIR}/ansilbe_log_test.log
ansible-playbook logit.yml
[ ! -f "${ALOG}" ]
ANSIBLE_LOG_PATH=${ALOG} ansible-playbook logit.yml
[ -f "${ALOG}" ]
grep -q 'ping' "${ALOG}"
Loading…
Cancel
Save