Ansible Python API 2.0 - capture warnings

Hello All
Been circling around the Callbackbase with all possible tries , but I could not find a way till now to capture these warnings from a playbook execution with the API output

[WARNING]: * Failed to parse hosts/UAT/ dictionary, got: <class ‘ansible.parsing.yaml.objects.AnsibleUnicode’>

[WARNING]: * Failed to parse /hosts/UAT/ssh_keys/dbrun_46186_1_uat with ini plugin:: Expected key=value host variable assignment, got: RSA

[WARNING]: Could not match supplied host pattern, ignoring: primary_host

Appreciate some help - on how to capture these warning messages when we run playbooks via the API?