Add prefix to Glog for child processes (c++)

267 Views Asked by At

In our service We have a master process that spawns multiple child worker processes. Those child process produce a good amount of logs using GLOG. This affects the readability of the main log. So we often set the minloglevel=2 for those child processes. But when our internal customers are debugging for some failures, those logs will be very helpful so we need to ask them to repeat their work without minloglevel=2 to get those logs. This is not fun and we are thinking of adding custom prefix for logs in front of certain child processes. Now it is the question how we could do that? We can go and change every LOG(INFO) << "My log" to LOG(INFO) << "MyPrefix" + "My log" But there could be thousands of lines that we need to work on. Is there a systematic way of doing this?

0

There are 0 best solutions below