So you want something like this then.
#include <iostream>
#include <string>
using namespace std;
typedef string (&ErrorFunc)();
string myError(){ return "Failure"; }
void logFile(const std::string& id,const ErrorFunc func){
cout << id << func() << endl;
//log into file
}
int main(){
logFile("Msg : ", myError );
}