
Hi, Is there a way with Boost.Log to have logging code emitted in a debug build but completely removed for release. The only way I can come up with is to have #if defs and #endif's scattered throughout the code. Has anyone come up with a better way? Any help appreciated. Kind Regards Sean.

This is the way its usually done: #if !RELEASE_BUILD DEBUG(x) Boost.Log(x) #else DEBUG(x) (void) #endif Then use the macro DEBUG instead, will make sure code is not emitted in release build. Regards /R Sean Farrow skrev 2014-03-03 12:09:
Hi,
Is there a way with Boost.Log to have logging code emitted in a debug build but completely removed for release.
The only way I can come up with is to have #if defs and #endif’s scattered throughout the code.
Has anyone come up with a better way?
Any help appreciated.
Kind Regards
Sean.
_______________________________________________ Boost-users mailing list Boost-users@lists.boost.org http://lists.boost.org/mailman/listinfo.cgi/boost-users

Sorry, was too fast, should of course be: #if !RELEASE_BUILD #define DEBUG(x) Boost.Log(x) #else #define DEBUG(x) (void) #endif hehe... /R Robert Bielik skrev 2014-03-03 12:12:
This is the way its usually done:
#if !RELEASE_BUILD DEBUG(x) Boost.Log(x) #else DEBUG(x) (void) #endif
Then use the macro DEBUG instead, will make sure code is not emitted in release build.
Regards /R
Sean Farrow skrev 2014-03-03 12:09:
Hi,
Is there a way with Boost.Log to have logging code emitted in a debug build but completely removed for release.
The only way I can come up with is to have #if defs and #endif’s scattered throughout the code.
Has anyone come up with a better way?
Any help appreciated.
Kind Regards
Sean.
_______________________________________________ Boost-users mailing list Boost-users@lists.boost.org http://lists.boost.org/mailman/listinfo.cgi/boost-users
_______________________________________________ Boost-users mailing list Boost-users@lists.boost.org http://lists.boost.org/mailman/listinfo.cgi/boost-users

Hi, Brilliant, thanks! Cheers Sean. -----Original Message----- From: Boost-users [mailto:boost-users-bounces@lists.boost.org] On Behalf Of Robert Bielik Sent: 03 March 2014 11:16 To: boost-users@lists.boost.org Subject: Re: [Boost-users] [Boost.Log] logging only in a debug build Sorry, was too fast, should of course be: #if !RELEASE_BUILD #define DEBUG(x) Boost.Log(x) #else #define DEBUG(x) (void) #endif hehe... /R Robert Bielik skrev 2014-03-03 12:12:
This is the way its usually done:
#if !RELEASE_BUILD DEBUG(x) Boost.Log(x) #else DEBUG(x) (void) #endif
Then use the macro DEBUG instead, will make sure code is not emitted in release build.
Regards /R
Sean Farrow skrev 2014-03-03 12:09:
Hi,
Is there a way with Boost.Log to have logging code emitted in a debug build but completely removed for release.
The only way I can come up with is to have #if defs and #endif's scattered throughout the code.
Has anyone come up with a better way?
Any help appreciated.
Kind Regards
Sean.
_______________________________________________ Boost-users mailing list Boost-users@lists.boost.org http://lists.boost.org/mailman/listinfo.cgi/boost-users
_______________________________________________ Boost-users mailing list Boost-users@lists.boost.org http://lists.boost.org/mailman/listinfo.cgi/boost-users
_______________________________________________ Boost-users mailing list Boost-users@lists.boost.org http://lists.boost.org/mailman/listinfo.cgi/boost-users
participants (2)
-
Robert Bielik
-
Sean Farrow