You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm currently in the process of migrating a big code base from aio-pika to faststream. The broker/amqp stuff worked out of the box first try, the biggest hurdle has been the Logger.
We have a custom global logger in the app, when we pass this to faststream we stop getting logs. I was able to hack it in place by using the logger from the subscriber callback and passing this to the main class object.
Some things that would be nice to have:
When creating a broker object the log_fmt param takes a string. In reality it should take either a string or log.Formatter.
Regardless of what I use as log_fmt, the level field becomes colored. This should also be a setting, since having colored logs adds weird characters. Ex broker(colors=True), default to True.
There's no param for passing a logging.Filter to the broker. These are normally used for setting contextvars. Ex `broker(log_filters=MyLogFilter())'
My current hack for this is to convert the faststream.Logger object into a logging.Logger then apply the filter before starting the broker.
When a consumer gets a message a log that says "Received" and "Processed" is printed. This uses by default message_id from the Message. There should be a way of overriding this without having to create a full custom logger. This probably should be Per Subscriber/Publisher as a param.
There should also be a way of disabling this
Add support for passing extra logging.Handlers to the broker.
The logger used by aio-pika doesn't following the formatting from the faststream one. The logs look out of place.
The text was updated successfully, but these errors were encountered:
I'm currently in the process of migrating a big code base from aio-pika to faststream. The broker/amqp stuff worked out of the box first try, the biggest hurdle has been the
Logger
.We have a custom global logger in the app, when we pass this to
faststream
we stop getting logs. I was able to hack it in place by using the logger from the subscriber callback and passing this to the main class object.Some things that would be nice to have:
When creating a broker object the
log_fmt
param takes a string. In reality it should take either astring
orlog.Formatter
.Regardless of what I use as log_fmt, the
level
field becomes colored. This should also be a setting, since having colored logs adds weird characters. Exbroker(colors=True)
, default to True.There's no param for passing a
logging.Filter
to the broker. These are normally used for settingcontextvars
. Ex `broker(log_filters=MyLogFilter())'message_id
from the Message. There should be a way of overriding this without having to create a full custom logger. This probably should be Per Subscriber/Publisher as a param.Add support for passing extra logging.Handlers to the broker.
The logger used by aio-pika doesn't following the formatting from the faststream one. The logs look out of place.
The text was updated successfully, but these errors were encountered: