We need a stack to handle the current group and verbosity settings when glog is called recursively, e.g.
void write()
{
glog.is(DEBUG1) && glog << group("bar") << "testing" << std::endl;
}
int main()
{
glog.is(DEBUG2) && glog << group("foo") << write() << std::endl;
}
In this case, the embedded call to write() calls glog again and when it is flushed (std::endl), the group and verbosity are erased. This means that in the case of multithreaded use, the logger mutex is never released, and other threads will wait forever on locking the mutex.
We need a stack to handle the current group and verbosity settings when glog is called recursively, e.g.
In this case, the embedded call to
write()calls glog again and when it is flushed (std::endl), the group and verbosity are erased. This means that in the case of multithreaded use, the logger mutex is never released, and other threads will wait forever on locking the mutex.