-
Notifications
You must be signed in to change notification settings - Fork 30
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
Add the possibity to log in both STDOUT and a file-object, with different formats. #128
Comments
We would like to inter-operate with logging nicely. When using Twisted, the above would be accomplished with "observers". In stdlib logging these are "handlers" (approximately?). As per #autobahn IRC conversation, it seems that txaio adds a root-level handler in |
Well when you use the txaio API you do not have access to the low-level object used internally by the std-lib or twisted logging module to configure it as you want. What I'd like I guess is an extended API in txaio that give the possibility to add an object interfaced on an observer/handler depending if you are using twisted or asyncio to the logger that you get when you call This object would allow you to configure the format and the destination used by the logger. I see that you can pass an observer to the twisted implementation of make_logger # tx.py
def make_logger(level=None, logger=_Logger, observer=None): Maybe it's a first step in that direction? I haven't dig enough into the code and i'm not familiar with twisted logging. |
I think maybe what you want to do is this:
If that does work for your use-case, the remaining part will be to ensure that txaio functions properly (and the logs are emitted correctly) if you call ONLY |
It is pretty much what i did. I do not call but as i pointed here crossbario/autobahn-python#952, the problem i face then is that a handler is still created by autobahn somewhere, so every records are logged two times. everything seems to work fine otherwise, even if I removed the created handler. |
Yes, |
I now use ApplicationRunner.run(ApplicationSession, start_loop=False), and launch the loop myself, so i can prevent the call to If I call |
Okay, so I think we should document that better -- basically "how to do your own logging stuff" |
What I'd like to do is:
I can't figure how to achieve it with the current API.
Is it something that goes against the philosophy of txaio or do you plan to have such features one day?
The text was updated successfully, but these errors were encountered: