Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

some logging fixes #56311

Open
wants to merge 3 commits into
base: devel
from

Conversation

Projects
None yet
6 participants
@bcoca
Copy link
Member

commented May 10, 2019

fixes #25757, #25758, #25761
alternative to #41859 and #25765

ISSUE TYPE
  • Bugfix Pull Request
COMPONENT NAME

display

before:

2019-05-10 12:52:31,375 p=27869 u=bcoca |   [WARNING]: No inventory was parsed, only implicit localhost is available

2019-05-10 12:52:31,537 passlib.registry registered 'md5_crypt' handler: <class 'passlib.handlers.md5_crypt.md5_crypt'>
2019-05-10 12:52:31,774 p=27869 u=bcoca |  localhost | SUCCESS => {
    "changed": false,
    "ping": "pong"
}

after:

2019-05-10 12:49:01,788 p=bcoca u=26808 |  [WARNING]: No inventory was parsed, only implicit localhost is available

2019-05-10 12:49:02,176 p=bcoca u=26808 | localhost | SUCCESS => {
    "changed": false,
    "ping": "pong"
}

not sure it is worth passing levels if they are not reflected in file (well, we do error/warning/deprecation ..)

bcoca added some commits May 10, 2019

some logging fixes
  fixes #25757, #25758, #25761
  alternative to #41859 and #25765
Show resolved Hide resolved lib/ansible/utils/display.py Outdated
if color:
# set logger level based on color (not great)
try:
lvl = color_to_log_level[color]

This comment has been minimized.

Copy link
@samdoran

samdoran May 10, 2019

Member

I don't have any experience with the logging code, but setting the level based on color seems a bit error prone. We don't have mechanism for the caller to set the log level rather than having to infer it based on color?

This comment has been minimized.

Copy link
@bcoca

bcoca May 10, 2019

Author Member

its not great, but that is how our 'error levels' work, and really breaks apart if someone makes them all the same

try:
lvl = color_to_log_level[color]
except KeyError:
# this should not happen, but JIC

This comment has been minimized.

Copy link
@mkrizek

mkrizek May 13, 2019

Contributor

I wonder if we should raise AnsibleAssertionError here then?

@jillr jillr removed the needs_triage label May 16, 2019

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.