Skip to content

Recursive calls to glog do not correctly handle "group" and "verbosity" settings #32

@tsaubergine

Description

@tsaubergine

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions