d2jsp
Log InRegister
d2jsp Forums > Off-Topic > Computers & IT > Programming & Development > Glog (google Logging Library)
Add Reply New Topic New Poll
Member
Posts: 1,358
Joined: Dec 30 2012
Gold: 0.10
Mar 31 2014 10:19pm
Trying to use glog but it doesn't seem to print out any overloaded messages.
Not sure if I'm just simply not defining a FLAGS_ variable or what.
I've looked over all the documentation for glog but can't figure it out.

Here's my code:
Code
void Debug::initialize(char* argv0)
{
google::InitGoogleLogging(argv0);

fLI::FLAGS_v = google::WARNING;
fLI::FLAGS_minloglevel = google::INFO;
fLI::FLAGS_stderrthreshold = google::INFO;
fLB::FLAGS_logtostderr = false;
fLB::FLAGS_colorlogtostderr = true;

LOG(INFO) << "test";
}


And it outputs the message like this to the log file and the console:

Code
I0331 21:59:14.929970 1998058256 debug.cpp:83]


But should output:

Code
I0331 21:59:14.929970 1998058256 debug.cpp:83] test


Also, another problem I'm having is.. I can't change the default log directory.

When I try to with fLS::FLAGS_log_dir = "new/dir/path/", I get a EXC_BAD_ACCESS message in Xcode:



What the hell am I missing?

This post was edited by SelfTaught on Mar 31 2014 10:20pm
Member
Posts: 1,358
Joined: Dec 30 2012
Gold: 0.10
Mar 31 2014 11:00pm
Managed to change the directory with the following code, still trying to figure out why its not printing the actual message.

Code
void Debug::initialize(char* argv0)
{
google::SetLogDestination(google::GLOG_INFO, Ini->v_LogDir.c_str());
google::InitGoogleLogging(argv0);

fLI::FLAGS_v = google::WARNING;
fLI::FLAGS_minloglevel = google::INFO;
fLI::FLAGS_stderrthreshold = google::INFO;
fLB::FLAGS_logtostderr = false;
fLB::FLAGS_colorlogtostderr = true;

LOG(INFO) << "test";
}


This post was edited by SelfTaught on Mar 31 2014 11:01pm
Member
Posts: 1,358
Joined: Dec 30 2012
Gold: 0.10
Apr 2 2014 10:07am
Found a wrapper for glog that I decided to go with and it works like a charm. This thread can be closed >.>
Go Back To Programming & Development Topic List
Add Reply New Topic New Poll