I want to create log.c file with containing info(), debug() and error() functions.
These functions are working without printing file name, line number,..etc.
So when I call one of this function I want to dump the file name, line number, and function name of the caller. So how do we exactly trace back?
Is there a way to trace back on C or, if we use macros, how can this be done?
I want to create log.c file with containing info(), debug() and error() functions. These
Share
I’d pass the data to the function through parameters (maybe get the help of a macro)
And to call them
Note:
__func__is C99; gcc, in mode C89 has__FUNCTION__