[Interest] Logging best practice.

Bo Thorsen bo at fioniasoftware.dk
Fri Dec 2 08:21:04 CET 2011


Den 01-12-2011 22:46, Charley Bay skrev:
>
> qLog(Type) << "string=" << str << ", int=" << i;
>
> That code is not re-entrant,

Wrong.

class LoggerHelper {
   ...
   ~LoggerHelper() {
     doActualLogging();
   }
};

LoggerHelper& operator<<(LoggerHelper&, const T&) {
   // Log T here
}

Bo Thorsen,
Fionia Software.

-- 

Expert Qt and C++ developer for hire
Contact me if you need expert Qt help
http://www.fioniasoftware.dk



More information about the Interest mailing list