Open GoogleCodeExporter opened 8 years ago
It was my mistake. I defined macro NDEBUG in the wrong header; the source file
where "debug mode" logging macros were used did not include that header.
The fix was just to define macro NDEBUG in the correct place ;-)
Original comment by alberto....@gmail.com
on 6 Sep 2011 at 5:14
I think I ran into a similar problem as you did, #define NDEBUG doesn't seem to
have an effect any logging output (DLOG didn't disappear) and was about to open
an issue on this. Is it supposed to use this way?
#include <iostream>
#include <glog/logging.h>
using namespace std;
#define NDEBUG 1
int main(int argc, char* argv[]) {
google::InitGoogleLogging(argv[0]);
DLOG(INFO) << "Hello World" << endl;
}
Original comment by fwa...@gmail.com
on 11 Jun 2012 at 6:36
The problem is that the macro NDEBUG should be defined before including glog
header.
I tried your code, and it works with this fix. (it works as assert function
http://www.cplusplus.com/reference/clibrary/cassert/assert/)
Just to notice that it is not necessary to set the constant value of NDEBUG
(i.e., 1).
Below I report the code corrected.
#define NDEBUG
#include <iostream>
#include <glog/logging.h>
using namespace std;
int main(int argc, char* argv[]) {
google::InitGoogleLogging(argv[0]);
DLOG(INFO) << "Hello World" << endl;
}
Original comment by alberto....@gmail.com
on 11 Jun 2012 at 9:24
Yes, this is the correct behavior. Appreciate the comments. I wish the
documents can be more clear on this.
Original comment by fwa...@gmail.com
on 12 Jun 2012 at 4:05
Original issue reported on code.google.com by
alberto....@gmail.com
on 30 Aug 2011 at 9:16