Our logging framework, like most logging frameworks, uses the __FUNCTION__
preprocessor macro to insert the current function into log files so that our logging looks like:
L4 T11332 609661594 [PreProcessorFunctions::RegenerateLinkIDs] [ENTER]
L4 T11332 609661594 [PreProcessorFunctions::RegenerateLinkIDs] [EXIT]
L4 T11332 609661594 [ConfigMerger::ValidateConfigObject] [ENTER]
L3 T11332 609661594 [ConfigMerger::ValidateConfigObject] Configuration Exists: 1
As we've started to use C++11 more, I've noticed that labmdas produce accurate yet unhelpful __FUNCTION__
output:
L4 T9604 609661594 [`anonymous-namespace'::<lambda1>::operator ()] Writing EMX config file: C:\windows\TEMP\CBE01448-32A2-493A-A9A1-2112F5709028\CA37BE5C-B398-4D61-980D-66B8E1E6D001\\EMXConfiguration.xml
L4 T11332 609661594 [`anonymous-namespace'::<lambda3>::operator ()] Writing Auditing config file: C:\windows\TEMP\CBE01448-32A2-493A-A9A1-2112F5709028\CA37BE5C-B398-4D61-980D-66B8E1E6D001\\Auditing.xml
L4 T11960 609661594 [`anonymous-namespace'::<lambda2>::operator ()] Writing UEM config file: C:\windows\TEMP\CBE01448-32A2-493A-A9A1-2112F5709028\CA37BE5C-B398-4D61-980D-66B8E1E6D001\\Configuration.xml
As you can see, all class scope has been lost and all we now know is that this logging statement came from an anonymous lambda. Does anyone have a good strategy for logging out the enclosing function? This would appear to be the most useful thing to log...