I'm not sure about the function pointer, but the predefined identifier __func__ returns the name of the function. Maybe this can help ...
In fact, I would replace your log function with a macro, so you do not need to insert a name every time as such:
#define log(x) log(__func__,x)
source share