-
-
Notifications
You must be signed in to change notification settings - Fork 1.6k
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
fix the logger and make it work #1397
Conversation
Codecov Report
@@ Coverage Diff @@
## master #1397 +/- ##
==========================================
- Coverage 81.4% 81.34% -0.06%
==========================================
Files 17 17
Lines 1694 1694
Branches 322 322
==========================================
- Hits 1379 1378 -1
Misses 247 247
- Partials 68 69 +1
Continue to review full report at Codecov.
|
@@ -6,7 +6,7 @@ | |||
version=1, | |||
disable_existing_loggers=False, | |||
loggers={ | |||
"root": {"level": "INFO", "handlers": ["console"]}, | |||
"sanic.root": {"level": "INFO", "handlers": ["console"]}, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Would you be kind enough to modify the unit test test_logging_defaults
to assert the default log level just so that issue like this will not creep into the release in the future?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It may not be a bad idea to add an explicit test case to validate the default root logger level as well.
def test_logging_modified_root_logger_config():
reset_logging()
modified_config = LOGGING_CONFIG_DEFAULTS
modified_config['loggers']['sanic.root']['level'] = "DEBUG"
app = Sanic("test_logging", log_config=modified_config)
assert logging.getLogger('sanic.root').getEffectiveLevel() == logging.DEBUG
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@harshanarayana thanks, I didn't think enough, I will modify it right now.
Something looks fishy in that coverage report. Why is |
I'm on my phone so I it's a little hard to do a sufficient review, but with this in place and passing, we can close #1049? |
@ahopkins I think so. This PR addresses the same issue. |
@KeepitReal555 @harshanarayana I'm afraid It's more complicated about those tests and this is why I didn't send the PR immediately. Let me address some problem I found:
More directly, current tests in |
I found out, but I don't konw why, maybe it's my mistake. |
@chenjr0719 You're right, there are bugs in the tests, I should also think about it. |
@chenjr0719 Agreed. I am more than happy to help if we need to rewrite the As for the handcrafter loggers go, the existing tests can be retained. But we need to have a similar test case that can validate the output in case if you are using IMHO, I think it might be a good idea to create a different PR that addresses the necessary fix in the |
@harshanarayana I like your idea, let me take a try, I will send another PR later. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I am adding my approval as this does the job of solving #1395 with the presumption that there will be another PR to beef up the tests.
I'm going to merge. @chenjr0719 added #1400 in response to @ahopkins approval, and I'd like to get this in to 18.12. |
Fixes #1395