Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

One of these days, I really need to post my C++ logger class. Don't know if you're doing embedded C++, but I've used this class in VxWorks, and if you're not logging anything (the default build with NDEBUG does nothing), it should optimize away.

For now, I can post a link to my inspiration: http://wordaligned.org/articles/cpp-streambufs

Extending from there is pretty straightforward, albeit you can hit some dark corners of C++ (I spent a few weeks tracking down a double link error caused by not templatizing an addition to the Logger that gave the capability to output to MSVS's debug window). This is also one of those very few cases in which I have justified using multiple inheritance, virtual inheritance, private inheritance, and templates.



Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: