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

Unable to force sanic-cors log level to INFO #45

Open
smlbiobot opened this issue May 3, 2020 · 2 comments
Open

Unable to force sanic-cors log level to INFO #45

smlbiobot opened this issue May 3, 2020 · 2 comments

Comments

@smlbiobot
Copy link

Based on your documentation, I should be able to force sanic-cors to show only logs at INFO level like this:

cors = CORS(app, resources={r"/static/*": {"origins": "*"}})
logging.getLogger('sanic_cors').level = logging.INFO

This works if the logging level for the app is also set to logging.INFO, but as soon as the app’s log level is set to logging.DEBUG, even with the second line added, sanic_cors level became debug.

This is mostly a nuisance, as I do need to enable debug for the main app for development, but the excessive debugs output by sanic_cors is making it very difficult for me to see the messages that I need.

Is there a way around it ? Thanks!

@ashleysommer
Copy link
Owner

Hi @smlbiobot
Thanks for opening this issue.
The documentation is left-over from when Sanic-Cors was ported from Flask-Cors.
Most of the documentation is still Flask-Cors specific, and some of it does not apply to Sanic-CORS. Documentation is still a work in progress.

I know currently the output level for Sanic-CORS is tied to the output level of Sanic, that is a limitation of the Sanic-Plugins-Framework, and it a feature that I'd like to get implemented when I get time.

@smlbiobot
Copy link
Author

Sounds good — hope you can resolve / update it. The output it generates is very excessive and I sometimes had to turn off sanic debug mode so that I can actually see what is happening.

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

No branches or pull requests

2 participants