I am using boost
program options
in my code and trying to add verbose logging using glog
(google logging library).
The problem is that boost
captures the command line options and I can not use the --v
flag for controlling the verbose logging. Is there a method for setting the minloglevel
from the code? I failed locating a function or a macro for doing that programatically...
I had the same problem and am managing to set glog flags in my main function as follows:
I found one work around and one answer that should but doesn't work. You can use the environment variable
GLOG_v
to set the verbosity level(on linux)
GLOG_v=2 ./your_binary
This works well but is not idealI also found the not very well documented function
google::SetVLOGLevel(char*, int)
that is exactly what I was looking for, but unfortunately using it throws an exception.