|
|
|
@ -18,6 +18,27 @@ void objectFileLoggingService::logMessage( CSTR Msg ){ |
|
|
|
|
|
|
|
void objectFileLoggingService::logMessage( const char *Msg ){ |
|
|
|
if ( m_bLogging ){ |
|
|
|
if( getFileSize( m_pFileName ) > MAX_LOG_FILE_SIZE ){ |
|
|
|
if ( MAX_LOG_FILE_BACKUPS ) { |
|
|
|
char tB[MAX_PATH_LEN]; |
|
|
|
sprintf( tB, "%s.%d", m_pFileName, MAX_LOG_FILE_BACKUPS ); |
|
|
|
if( fileExist( tB ) ) unlink( tB ); |
|
|
|
uint8_t ix = 0; |
|
|
|
do{ |
|
|
|
char tZ[MAX_PATH_LEN]; |
|
|
|
if ( ix ) { |
|
|
|
sprintf( tB,"%s.%d", m_pFileName, ix++ ); |
|
|
|
sprintf( tZ,"%s.%d", m_pFileName, ix++ ); |
|
|
|
} else { |
|
|
|
sprintf( tB,"%s", m_pFileName ); |
|
|
|
sprintf( tZ,"%s.%d", m_pFileName, ++ix ); |
|
|
|
}; |
|
|
|
rename( tB, tZ ); |
|
|
|
}while( ix < MAX_LOG_FILE_BACKUPS ); |
|
|
|
} else { |
|
|
|
unlink( m_pFileName ); |
|
|
|
}; |
|
|
|
}; |
|
|
|
FILE *FD; |
|
|
|
FD = fopen( m_pFileName , "a+"); |
|
|
|
if( FD != NULL ) { |
|
|
|
|