Changeset 13 for trunk/txlib/txstdcmd.c

Show
Ignore:
Timestamp:
05/13/06 20:33:09 (3 years ago)
Author:
jvw
Message:

Logfile size-limit and automatic logfile rotation, very useful for crash tracing

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • trunk/txlib/txstdcmd.c

    r11 r13  
    101101         TxSetLogReOpen( TxaOption('r')); 
    102102      } 
    103       TxAppendToLogFile( c1); 
     103      if (TxaOptSet('m')) 
     104      { 
     105         TxSetLogMaxSize( TxaOptBkmg( 'm', 2047, 'k')); 
     106      } 
     107      if (TxaOptSet('f')) 
     108      { 
     109         TxSetLogRetain( TxaOptNum('f', NULL, 1)); 
     110      } 
     111      TxAppendToLogFile( c1, TRUE); 
    104112   } 
    105113   else if (stricmp(c0, "trace"    ) == 0) 
     
    110118                  "Usage:  trace  [-r] [-s] [-t] [level | filename]\n\n" 
    111119                  "   -d[:xx]      add xx ms delay for each trace line, slowdown\n" 
     120                  "   -f[:ff]      retain ff numbered logfiles when cycling\n" 
     121                  "   -m[:mm]      cycle to next logfile after size mm\n" 
    112122                  "   -r           close and reopen log on each line (slow)\n" 
    113123                  "   -r-          open log just once (this is the default)\n" 
     
    139149            TxTrLogOnly =   !TxaOption('s');    // to screen with -s 
    140150         } 
     151         if (TxaOptSet('m')) 
     152         { 
     153            TxSetLogMaxSize( TxaOptBkmg( 'm', 2047, 'k')); 
     154         } 
     155         if (TxaOptSet('f')) 
     156         { 
     157            TxSetLogRetain( TxaOptNum('f', NULL, 1)); 
     158         } 
    141159         if (isdigit( c1[0]))                   // setting a level 
    142160         { 
     
    147165            if (strlen( c1)) 
    148166            { 
    149                TxAppendToLogFile( c1); 
     167               TxAppendToLogFile( c1, TRUE); 
    150168               TxTrLevel = 100; 
    151169            }