-# define SG_LOG(C,P,M) sglog() << loglevel(C,P) << M << std::endl
+# define SG_LOG(C,P,M) do { \
+ logstream& __tmplogstreamref(sglog()); \
+ if(__tmplogstreamref.would_log(C,P)) { \
+ __tmplogstreamref << loglevel(C,P) << M << std::endl; } \
+ } while(0)