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

feat: lower the default LogLevel for ape test command #2212

Merged
merged 4 commits into from
Aug 12, 2024

Conversation

antazoey
Copy link
Member

@antazoey antazoey commented Aug 8, 2024

What I did

The default log level for ape test is too verbose imo,
the amount of logs of deploying txns and stuff is in the way of the stacktraces

How I did it

How to verify it

Checklist

  • All changes are completed
  • New test cases have been added
  • Documentation has been updated

@antazoey antazoey marked this pull request as ready for review August 8, 2024 18:21
Copy link
Member

@fubuloubu fubuloubu left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Making sure I understand this, this only increases the default log level for ape test?

@antazoey
Copy link
Member Author

antazoey commented Aug 8, 2024

Making sure I understand this, this only increases the default log level for ape test?

Correct!

To test (which I just did!), make a script like:

from ape.logging import logger

def main():
    logger.info("test")
    logger.error("test2")

Notice it still logs the info! (and the error of course), like:

INFO (ape-playground): test
ERROR (ape-playground): test2

Then, make a test like:

from ape.logging import logger

def test_log():
    logger.info("test")
    logger.info("test")
    logger.warning("asdf")
    logger.error("ASDFASDFASDFASDFASDFASDF")
    logger.info("test")
    assert False

The captured logs look like:

----------------------------------- Captured log call -----------------------------------
WARNING  ape:test_log.py:6 asdf
ERROR    ape:test_log.py:7 ASDFASDFASDFASDFASDFASDF

@antazoey
Copy link
Member Author

antazoey commented Aug 8, 2024

and then ape test -v info will all the logs (from example above)

INFO     ape:test_showt.py:4 test
INFO     ape:test_showt.py:5 test
WARNING  ape:test_showt.py:6 asdf
ERROR    ape:test_showt.py:7 ASDFASDFASDFASDFASDFASDF
INFO     ape:test_showt.py:8 test

@antazoey antazoey enabled auto-merge (squash) August 12, 2024 20:59
@antazoey antazoey merged commit dec6b28 into ApeWorX:main Aug 12, 2024
15 checks passed
@antazoey antazoey deleted the feat/lower-def-apetest-loglvl branch August 14, 2024 16:01
@antazoey antazoey mentioned this pull request Aug 19, 2024
3 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants