Changeset 9320 for trunk/src/kernel32/dbglog.cpp
- Timestamp:
- Oct 3, 2002, 2:49:50 PM (23 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/kernel32/dbglog.cpp
r8922 r9320 1 /* $Id: dbglog.cpp,v 1. 1 2002-07-26 10:46:14sandervl Exp $ */1 /* $Id: dbglog.cpp,v 1.2 2002-10-03 12:49:50 sandervl Exp $ */ 2 2 3 3 /* … … 270 270 //#define LOG_TIME 271 271 //#define SHOW_FPU_CONTROLREG 272 //#define WIN32_IP_LOGGING 273 #define WIN32_IP_LOG_PORT 5001 274 275 #ifdef WIN32_IP_LOGGING 276 #include <types.h> 277 #include <netinet/in.h> 278 #include <sys/socket.h> 279 280 static int logSocket = -1; 281 static char *logserver = NULL; 282 #endif 272 283 273 284 int SYSTEM WriteLog(char *tekst, ...) … … 290 301 #else 291 302 if(!getenv("NOWIN32LOG")) { 303 #endif 304 305 #ifdef WIN32_IP_LOGGING 306 logserver = getenv("WIN32LOG_IPSERVER"); 307 if(logserver) { 308 sock_init(); 309 310 logSocket = socket(PF_INET, SOCK_DGRAM, 0); 311 } 292 312 #endif 293 313 char logname[CCHMAXPATH]; … … 337 357 { 338 358 va_start(argptr, tekst); 359 360 #ifdef WIN32_IP_LOGGING 361 if(logSocket == -1) { 362 #endif 339 363 if(teb) 340 364 { … … 393 417 } 394 418 #endif 419 #ifdef WIN32_IP_LOGGING 420 } 421 #endif 422 423 #ifdef WIN32_IP_LOGGING 424 if(logSocket != -1) { 425 char logbuffer[1024]; 426 int prefixlen = 0; 427 428 if(teb) 429 { 430 ULONG ulCallDepth; 431 #ifdef DEBUG 432 ulCallDepth = teb->o.odin.dbgCallDepth; 433 #else 434 ulCallDepth = 0; 435 #endif 436 if(sel == 0x150b && !fIsOS2Image) 437 sprintf(logbuffer, "t%02d (%3d): (FS=150B) ", 438 LOWORD(teb->o.odin.threadId), ulCallDepth); 439 else 440 sprintf(logbuffer, "t%02d (%3d): ", 441 LOWORD(teb->o.odin.threadId), ulCallDepth); 442 prefixlen = strlen(logbuffer); 443 } 444 445 vsprintf(&logbuffer[prefixlen], tekst, argptr); 446 447 struct sockaddr_in servername; 448 int rc; 449 450 memset(&servername, 0, sizeof(servername)); 451 servername.sin_family = AF_INET; 452 servername.sin_addr.s_addr = inet_addr(logserver); 453 servername.sin_port = WIN32_IP_LOG_PORT; 454 rc = sendto(logSocket, logbuffer, strlen(logbuffer)+1, 0, (struct sockaddr *)&servername, sizeof(servername)); 455 456 if(teb) teb->o.odin.logfile = 0; 457 va_end(argptr); 458 } 459 else { 460 vfprintf(flog, tekst, argptr); 461 if(teb) teb->o.odin.logfile = 0; 462 va_end(argptr); 463 464 if(tekst[strlen(tekst)-1] != '\n') 465 fprintf(flog, "\n"); 466 467 if(fFlushLines) 468 fflush(flog); 469 } 470 #else 395 471 vfprintf(flog, tekst, argptr); 396 472 if(teb) teb->o.odin.logfile = 0; … … 402 478 if(fFlushLines) 403 479 fflush(flog); 480 #endif 404 481 } 405 482 SetFS(sel); … … 573 650 if(oldcrtmsghandle) 574 651 _set_crt_msg_handle(oldcrtmsghandle); 652 653 #ifdef WIN32_IP_LOGGING 654 if(logSocket != -1) { 655 soclose(logSocket); 656 } 657 #endif 575 658 576 659 if(flog) fclose(flog);
Note:
See TracChangeset
for help on using the changeset viewer.