|
|
|
@ -23,29 +23,27 @@ void objectFileLoggingService::logMessage( const char *Msg ){ |
|
|
|
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{ |
|
|
|
uint8_t ix = MAX_LOG_FILE_BACKUPS; |
|
|
|
while( ix ){ |
|
|
|
char tZ[MAX_PATH_LEN]; |
|
|
|
if ( ix ) { |
|
|
|
sprintf( tB,"%s.%d", m_pFileName, ix++ ); |
|
|
|
sprintf( tZ,"%s.%d", m_pFileName, ix++ ); |
|
|
|
sprintf( tZ,"%s.%d", m_pFileName, ix ); |
|
|
|
if ( ix - 1 ) { |
|
|
|
sprintf( tB,"%s.%d", m_pFileName, ix - 1 ); |
|
|
|
} else { |
|
|
|
sprintf( tB,"%s", m_pFileName ); |
|
|
|
sprintf( tZ,"%s.%d", m_pFileName, ++ix ); |
|
|
|
}; |
|
|
|
rename( tB, tZ ); |
|
|
|
}while( ix < MAX_LOG_FILE_BACKUPS ); |
|
|
|
if( fileExist( tB ) ) rename( tB, tZ ); |
|
|
|
ix--; |
|
|
|
}; |
|
|
|
} else { |
|
|
|
unlink( m_pFileName ); |
|
|
|
}; |
|
|
|
}; |
|
|
|
FILE *FD; |
|
|
|
FD = fopen( m_pFileName , "a+"); |
|
|
|
FD = fopen( m_pFileName , "a+"); |
|
|
|
if( FD != NULL ) { |
|
|
|
fwrite( Msg, 1, strlen(Msg), FD ); |
|
|
|
fclose(FD); |
|
|
|
} else { |
|
|
|
printf( "Totally Lost\n" ); |
|
|
|
}; |
|
|
|
}; |
|
|
|
}; |