0

I have to implement a logger class, taking a log id, and printing the necessary information, pre-read from xml code. Initially, I have a problem of logging the file name and line number.

Before when I used glog in main.cpp,

std::map<std::string, std::string>::iterator it = logs.find(logId);
LOG(ERROR) << logId;

it was printing

E0803 10:16:57.219295 10244 main.cpp:129] Incorrect input

Now I moved the function inside my logger wrapper. I'm (as expected) getting :

E0803 10:17:03.587898 10244 DummyLogger.cpp:65] Incorrect input 

Everyting is logged gives the same line number of DummyLogger.cpp class now (as expected). But I would like it to print the caller's name and line number. Is that possible?

sayginify
  • 83
  • 1
  • 8
  • You have to create MACRO which calls `__FILE__`, `__LINE__`. – Jarod42 Aug 03 '15 at 08:28
  • That's the only way I suppose. I had already checked this [link](http://stackoverflow.com/questions/2849832/c-c-line-number) But I was wondering if that could be possible to configure glog – sayginify Aug 03 '15 at 10:33

0 Answers0