home *** CD-ROM | disk | FTP | other *** search
- #include "TxtLog.h"
- #include "String.h"
-
- TxtLog::~TxtLog()
- {
- if( file )
- {
- fputs( "---------------------Loging stopped------------------------------\n", file );
- fclose( file ); file = 0;
- }
- }
-
- void TxtLog::warning(const String & str)
- {
- if( file )
- {
- fprintf( file, "----Warning----: %s\n", (const char *)str );
- fflush( file );
- }
- }
-
- void TxtLog::message(const String & str)
- {
- if( file )
- {
- fputs( (const char *)str, file );
- fflush( file );
- }
- }
- void TxtLog::error(const String & str)
- {
- if( file )
- {
- fprintf( file, "-----Error-----: %s\n", (const char *)str );
- fflush( file );
- }
- }
-
- TxtLog::TxtLog(const String & fname, const String & header)
- : file( fopen( (const char *)fname, "wt" ) )
- {
- if( file )
- {
- fputs( header, file );
- fputs( "\n", file );
- fputs( "---------------------Loging started------------------------------\n", file );
- fflush( file );
- }
- }
-