joelteply / google-glog

Automatically exported from code.google.com/p/google-glog
Other
0 stars 0 forks source link

Setting log level at compile time #14

Open GoogleCodeExporter opened 8 years ago

GoogleCodeExporter commented 8 years ago
In my code I need to log inside loops if something bad happens. Since this
logging is executed very often I want to decide at compile time whether I
enable it or not. So that the compiler is able to remove this additional
code. I just had a look at glog and it seems that almost everything is set
up at runtime. This way the logging code is already in the binary. Is there
a way to get rid of this? I'm feeling a bit stupid. So maybe there are
other way's around this since you don't seem to have considered this problem.
The DLOG* statements go in that direction. But let's say I enabled
debugging then all these statements will be in my code despite I want only
ERRORs to be shown.

Regards

Original issue reported on code.google.com by jens.k.mueller@gmail.com on 6 Oct 2009 at 10:46

GoogleCodeExporter commented 8 years ago
[deleted comment]
GoogleCodeExporter commented 8 years ago
Not sure, but GOOGLE_STRIP_LOG isn't what you are looking for?

http://google-glog.googlecode.com/svn/trunk/doc/glog.html#strip

(I modified this comment because the link was wrong in the first post)

Original comment by shinichi...@gmail.com on 6 Oct 2009 at 1:05

GoogleCodeExporter commented 8 years ago
Oh yes. I think that is what I need. Just to make sure: If I use a LOG_IF 
statement
then the code for the condition is removed as well. Right? The documentation for
GOOGLE_STRIP_LOG isn't very specific in this case. It's only about getting rid 
of the
logging strings.

Original comment by jens.k.mueller@gmail.com on 6 Oct 2009 at 6:38

GoogleCodeExporter commented 8 years ago
Ah, yes... It seems we have few code generated even with GOOGLE_STRIP_LOG. I'll 
fix 
this. Thanks!

Original comment by shinichi...@gmail.com on 7 Oct 2009 at 9:13