Logging replaced, I love macros

Captain's Log: Stardate 77533.4

Well, I'm now wishing that I had worked out the logger design I wanted earlier. 🙂

The logger itself was pretty easy to implement, but changing over all the stream-based logging statements to format-based was a hassle. The more involved part was changing all the operator<<() implementations to formatters. I understand why std::formatter is the way it is, and it's powerful, but... damn is it verbose. Thankfully I was able to make a macro that de-boilerplates simple formatters, so that's nice.

(As an aside, I love macros. They get so much hate, and sure, exposing macros as part of your API sucks. But I get so much ridiculous value out of macros that I define, use 10 times, and then undefine right afterwards. So the scope is limited, they can't cause damage elsewhere. I'd guess that Anukari is 3,000 lines of code lighter due to macros. And of course I use constexpr where I can, but there are things it can't do, like insert a return statement or break into the caller.)

Hopefully I can wrap up the logging stuff tomorrow, maybe Monday. Not really something I wanted to spend this much time on, but it really was necessary -- I need to be able to safely get logs out of the audio thread so that when the alpha starts, I can have people send me their logs when it crashes, etc. Otherwise remote debugging is going to suck.


© 2024 Anukari LLC, All Rights Reserved
Contact Us|Legal