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
BINLOG_ADAPT_STRUCT allows logging used defined types and their members. However, the user has no control over the formatting when the type is pretty-printed.
One possibility is to simply do the formatting on the producer side, but that is less than ideal for performance.
What's the best way to add support for custom formatting of user defined types, preferably via a standard interface like operator<<?
The text was updated successfully, but these errors were encountered:
Your suggestion seems to pretty-fy adapted structs.
I am looking to avoid adapting all together as it can get quite messy for my logging needs, e.g. my type might have a vector and I want to log only 1st few entries of it. Also in my project it's advised to have a standard logging mechanism (implementing operator << or fmt::format), I was hoping to use same infrastructure.
I didn't look deeper but will something like below work?
Have a dedicated thread for consuming from queues. And writing out directly to text format, i.e. TextOutputStream.
Pass (log) a pointer as binlog::address or void*, along with some tag/category (saying it's a user_defined_type Type1)
check for special tag/category, if yes then extract pointer from buffer, cast it to Type1 and use already defined fmt::format, operator << etc for that type to serialize.
I am aware of potential issues of using dangling pointers and logging outdated object state here, but let's assume that is acceptable.
BINLOG_ADAPT_STRUCT allows logging used defined types and their members. However, the user has no control over the formatting when the type is pretty-printed.
One possibility is to simply do the formatting on the producer side, but that is less than ideal for performance.
What's the best way to add support for custom formatting of user defined types, preferably via a standard interface like operator<<?
The text was updated successfully, but these errors were encountered: