Changeset 13 for trunk/txlib/txcon.c
- Timestamp:
- May 13, 2006, 8:33:09 PM (19 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
TabularUnified trunk/txlib/txcon.c ¶
r11 r13 75 75 static char txc_ansi = A_ON; 76 76 77 //- logfile cycling and size control 78 static ULONG log_written = 0; // bytes written on this file 79 static ULONG log_maxsize = 0; // maximum size per logfile 80 static ULONG log_seq_num = 0; // sequence number 0..n 81 static ULONG log_retain = 0; // log recycle retain count 77 82 78 83 //- Note: 256 color strings sorted in default PC order … … 460 465 461 466 /*****************************************************************************/ 467 // Set logfile maximum size per file 468 /*****************************************************************************/ 469 void TxSetLogMaxSize 470 ( 471 ULONG size // IN maximum size, bytes 472 ) 473 { 474 log_maxsize = size; 475 } // end 'TxSetLogMaxSize' 476 /*---------------------------------------------------------------------------*/ 477 478 479 /*****************************************************************************/ 480 // Set logfile number of files to retain on cycle, #files besides .log itself 481 /*****************************************************************************/ 482 void TxSetLogRetain 483 ( 484 ULONG retain // IN retain count 485 ) 486 { 487 log_retain = retain; 488 } // end 'TxSetLogRetain' 489 /*---------------------------------------------------------------------------*/ 490 491 492 /*****************************************************************************/ 462 493 // printf-like print on stdout, LOG filehandle and raw/clean copy hooks 463 494 /*****************************************************************************/ … … 528 559 TxAscii827( txm_buff, TXASCII827_TRANS); 529 560 } 561 562 if ((log_maxsize > size) && (log_written > (log_maxsize - size))) 563 { 564 TXLN fname; 565 566 log_written = 0; // avoid recursive cycling 567 fprintf( log_handle, "\nClosing logfile at size limit\n"); 568 569 TxAppendToLogFile( NULL, FALSE); // close current log, quiet 570 if (log_seq_num >= log_retain) // need to delete one 571 { 572 TxBuildLogName( log_seq_num - log_retain, fname); 573 remove( fname); // delete a logfile (cycle) 574 } 575 TxBuildLogName( (log_retain) ? ++log_seq_num : 0, fname); 576 TxAppendToLogFile( fname, FALSE); // open next logfile, quiet 577 log_handle = TxQueryLogFile( &log7bit, &logreopen); 578 fprintf( log_handle, "Start next logfile: '%s'\n", fname); 579 } 580 else 581 { 582 log_written += size; // maintain total size in log 583 } 584 530 585 fprintf( log_handle, "%s", txm_buff); 531 586 if (logreopen)
Note:
See TracChangeset
for help on using the changeset viewer.