@@ -267,13 +267,35 @@ void LogDebugTrace(const char* function, const char *format, ...)
267
267
{
268
268
lock_guard<mutex> lock (g_log_mutex);
269
269
270
+ // Parse out "class::function" from PRETTY_FUNCTION which includes the return type and full arg list
271
+ // This normally gives us zillions of templates we dont need to see!
272
+ string sfunc (function);
273
+ size_t colpos = sfunc.find (" ::" );
274
+ size_t poff = sfunc.find (" (" , colpos);
275
+ size_t coff = sfunc.rfind (" " , colpos);
276
+ if ( (colpos != string::npos) && (poff != string::npos) && (coff != string::npos) )
277
+ {
278
+ // C++ function. If we don't get here it's a C function, so use the entire function name in the log message.
279
+
280
+ // Get the function name
281
+ size_t namelen = poff - colpos - 2 ;
282
+ string name = sfunc.substr (colpos+2 , namelen);
283
+
284
+ // Get the class name
285
+ size_t clen = colpos - coff + 1 ;
286
+ string cls = sfunc.substr (coff + 1 , clen);
287
+
288
+ // Format final result
289
+ sfunc = cls + " ::" + name;
290
+ }
291
+
270
292
// TODO: Check if we match a global "things we want to log" filter
271
293
272
294
va_list va;
273
295
for (auto &sink : g_log_sinks)
274
296
{
275
297
// First, print the function name prefix
276
- sink->Log (Severity::DEBUG, string (function) );
298
+ sink->Log (Severity::DEBUG, string (" [ " ) + sfunc + " ] " );
277
299
278
300
// then the message
279
301
va_start (va, format);
0 commit comments