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

How to use cleanly atoms in aiohttp.server ? #174

Closed
ludovic-gasc opened this issue Nov 9, 2014 · 7 comments
Closed

How to use cleanly atoms in aiohttp.server ? #174

ludovic-gasc opened this issue Nov 9, 2014 · 7 comments
Labels

Comments

@ludovic-gasc
Copy link
Contributor

Hi,

I'm using aiohttp.server and self.log_access() in a daemon for a customer, I need to log user agent.

By default, in aiohttp.server, user agent log is enabled via "%(a)s": https://github.com/KeepSafe/aiohttp/blob/master/aiohttp/server.py#L29

But, to show this piece of information, atoms() needs an environ variable: https://github.com/KeepSafe/aiohttp/blob/master/aiohttp/helpers.py#L240

By default in aiohttp.server, environ is None: https://github.com/KeepSafe/aiohttp/blob/master/aiohttp/server.py#L300
https://github.com/KeepSafe/aiohttp/blob/master/aiohttp/server.py#L330

What's the good practice to generate environ variable ?
Generate myself ? It isn't clear for me what it means.
Or maybe, we could change a little bit the code to use directly content in message variable ?
I can make a PR if it's ok for you.

@fafhrd91
Copy link
Member

Yes, let's modify this code. Initially I used that code only with wsgi server

@fafhrd91
Copy link
Member

PR would be cool!

@ludovic-gasc
Copy link
Contributor Author

Ok, I will make a PR.
I prefer to discuss before PR, to avoid to waste my time with a rejected PR.

@fafhrd91
Copy link
Member

I think main question where to add support for atoms. It could be server level or web.py level. I'd prefer aiohttp.web

@GMLudo are you planing to use aiohttp.web ?

@ludovic-gasc
Copy link
Contributor Author

It's planned, but waiting that aiohttp.web officially released and do his diseases with some users.
Nevertheless, for this specific question, I prefer to keep that in aiohttp.server.
I see Web for a high level API (router, application. ..) but for me, atoms is necessary in low level. Almost everybody that uses aiohttp as server needs that.

@fafhrd91
Copy link
Member

fafhrd91 commented Dec 1, 2014

access logging added to aiohttp.web d46679c

@fafhrd91 fafhrd91 closed this as completed Dec 1, 2014
@lock
Copy link

lock bot commented Oct 29, 2019

This thread has been automatically locked since there has not been
any recent activity after it was closed. Please open a new issue for
related bugs.

If you feel like there's important points made in this discussion,
please include those exceprts into that new issue.

@lock lock bot added the outdated label Oct 29, 2019
@lock lock bot locked as resolved and limited conversation to collaborators Oct 29, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

2 participants