Vegastrike 0.5.1 rc1
1.0
Original sources for Vegastrike Evolved
Main Page
Related Pages
Modules
Namespaces
Classes
Files
File List
File Members
All
Classes
Namespaces
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Friends
Macros
Groups
Pages
vsnet_debug.cpp
Go to the documentation of this file.
1
#include "
vsnet_debug.h
"
2
3
#include <time.h>
4
#include <cstring>
5
#if !defined (_WIN32)
6
#include <sys/time.h>
7
#else
8
#include <winsock.h>
9
#endif
10
11
using
std::ostream;
12
using
std::clog;
13
14
struct
TimeTriggerStruct
{};
15
16
static
TimeTriggerStruct
time_trigger
;
17
ostream&
operator<<
( ostream &ostr,
const
TimeTriggerStruct
&
c
)
18
{
19
#ifndef _WIN32
20
struct
timeval tv;
21
gettimeofday( &tv, NULL );
22
ostr<<tv.tv_sec<<
":"
<<tv.tv_usec;
23
#endif
24
return
ostr;
25
}
26
27
ostream&
vsnetDbgOut
(
const
char
*
file
,
int
line )
28
{
29
const
char
*printme =
file
;
30
int
len = strlen( file );
31
if
(len > 30) printme = &file[len-30];
32
#ifdef VSNET_DEBUG
33
clog<<
PTHREAD_SELF_OR_NONE
<<
" "
34
<<time_trigger
35
<<
" "
<<printme<<
":"
<<line<<
" "
;
36
#else
/* !VSNET_DEBUG */
37
clog<<printme<<
":"
<<line<<
" "
;
38
#endif
/* VSNET_DEBUG */
39
return
clog;
40
}
41
src
networking
lowlevel
vsnet_debug.cpp
Generated on Fri May 29 2015 23:07:35 for Vegastrike 0.5.1 rc1 by
1.8.4