Flow-IPC / ipc

[Start here!] Flow-IPC - Modern C++ toolkit for high-speed inter-process communication (IPC)
https://flow-ipc.github.io/
Apache License 2.0
280 stars 11 forks source link

ipc_*: Normalize logging names/thread names. #85

Open ygoldfeld opened 6 months ago

ygoldfeld commented 6 months ago

Filed by @ygoldfeld pre-open-source:

~All types in Flow-IPC (outside of non-ipc::session::shm SHM-jemalloc-land, I think, which should probably be changed, but that's orthogonal) have operator<< for ostream output, used in ~all log call sites. Plus when creating background threads they're usually named using the same thing. Some types also have nickname() (given by user in ctor) in the mix in there.

The names tend to be reasonably helpfully descriptive, though a once-over on that count wouldn't hurt as part of this ticket. However the formatting is inconsistent; sometimes there's this address near the start, sometimes at the end (which can be particularly unnerving when an internally stored object is itself <<ed inside the <<). Sometimes they're too long to be used as Linux thread names helpfully. Sometimes nickname() is included, other times it IS nickname().

You get the idea. Someone should holistically look at this, come up with some conventions, and straighten it all out.

Additionally it would be nice to come up with some boiler-plate-reducing way of pre-pending the "<whatever object> [" << *this << "]:" thing automatically to log calls.

Anyway. Just make it nice. And probably it should share DNA with Flow-IPC/flow#86.


Addendum: flow-ipc/flow#71 is related; or at least the musing in its Description "addendum" is. Basically that is about thread naming conventions, possibly having a separate API arg in flow.log to name a thread natively for the OS (top and such), which has a length limit in Linux at least. It's all part of one mess that would be good to straighten out. So this guy and that guy should probably be looked-at together.