So, I just started playing with log4cxx today. I've used log4cpp in the past, but it appears to have stagnated, so I thought I'd make a change.

Anyway, one of the first things I noticed was that NDC's don't have a natural way to follow the RAII paradigm to ensure they get cleaned up. I made a simple wrapper class that seems to work just fine. So, I'm curious, does it make sense to have something like this:

struct NDCGuard {
   inline NDCGuard(const String& message) {
       NDC::push(message);
   }

   inline ~NDCGuard() {
       NDC::pop();
   }
};

It should add no overhead, but it makes for a simple way to manage your NDC's without them getting out of sync. Thoughts?

--Chris



Reply via email to