MCPcopy Create free account
hub / github.com/ValveSoftware/GameNetworkingSockets / DebugOutput

Function DebugOutput

tests/test_common.cpp:30–68  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

28}
29
30static void DebugOutput( ESteamNetworkingSocketsDebugOutputType eType, const char *pszMsg )
31{
32 // !KLUDGE!
33 if ( strstr( pszMsg, "Send Nagle") )
34 return;
35
36 SteamNetworkingMicroseconds time = SteamNetworkingUtils()->GetLocalTimestamp() - g_logTimeZero;
37 if ( g_fpLog )
38 fprintf( g_fpLog, "%10.6f %s\n", time*1e-6, pszMsg );
39 if ( eType <= g_eTestStdoutDetailLevel )
40 {
41 printf( "%10.6f %s\n", time*1e-6, pszMsg );
42 fflush(stdout);
43 }
44 if ( eType == k_ESteamNetworkingSocketsDebugOutputType_Bug )
45 {
46 fflush(stdout);
47 fflush(stderr);
48 if ( g_fpLog )
49 fflush( g_fpLog );
50
51 // !KLUDGE! Our logging (which is done while we hold the lock)
52 // is occasionally triggering this assert. Just ignore that one
53 // error for now.
54 // Yes, this is a kludge.
55 if ( strstr( pszMsg, "lock held for" ) || strstr( pszMsg, "waited" ) && strstr( pszMsg, "for lock" ) )
56 return;
57
58 fprintf( stderr, "\n\n"
59 "%s\n"
60 "!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!\n"
61 "!! TEST FAILED !!\n"
62 "!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!\n",
63 pszMsg
64 );
65 fflush( stderr );
66 _exit(1);
67 }
68}
69
70void TEST_Printf( const char *fmt, ... )
71{

Callers 1

TEST_PrintfFunction · 0.70

Calls 2

SteamNetworkingUtilsFunction · 0.85
GetLocalTimestampMethod · 0.80

Tested by

no test coverage detected