-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathdriverlog.cpp
More file actions
60 lines (42 loc) · 941 Bytes
/
driverlog.cpp
File metadata and controls
60 lines (42 loc) · 941 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
//========= Copyright Valve Corporation ============//
#include "driverlog.h"
#include <stdio.h>
#include <stdarg.h>
static vr::IVRDriverLog * s_pLogFile = NULL;
#if !defined( WIN32)
#define vsnprintf_s vsnprintf
#endif
bool InitDriverLog( vr::IVRDriverLog *pDriverLog )
{
if( s_pLogFile )
return false;
s_pLogFile = pDriverLog;
return s_pLogFile != NULL;
}
void CleanupDriverLog()
{
s_pLogFile = NULL;
}
static void DriverLogVarArgs( const char *pMsgFormat, va_list args )
{
char buf[1024];
vsnprintf_s( buf, sizeof(buf), pMsgFormat, args );
if( s_pLogFile )
s_pLogFile->Log( buf );
}
void DriverLog( const char *pMsgFormat, ... )
{
va_list args;
va_start( args, pMsgFormat );
DriverLogVarArgs( pMsgFormat, args );
va_end(args);
}
void DebugDriverLog( const char *pMsgFormat, ... )
{
#ifdef _DEBUG
va_list args;
va_start( args, pMsgFormat );
DriverLogVarArgs( pMsgFormat, args );
va_end(args);
#endif
}