@ -46,19 +46,21 @@ namespace {
# ifdef ERROR
# ifdef ERROR
# undef ERROR
# undef ERROR
# endif
# endif
enum E Error
enum T Error
{
{
ERROR ,
ERROR ,
WARNING ,
WARNING ,
MESSAGE ,
MESSAGE ,
} ;
} ;
const std : : string s_Error = " ERROR " ;
enum TDepend
const std : : string s_Warning = " WARNING " ;
{
const std : : string s_Message = " MESSAGE " ;
BUILD ,
RUNTIME ,
} ;
const std : : string s_ErrorHeader = " type \t path \t time \t error " ;
const std : : string s_ErrorHeader = " type \t path \t time \t error " ;
const std : : string s_DependHeader = " output_file\t input_file " ;
const std : : string s_DependHeader = " type\t output_file\t input_file " ;
/**
/**
* \ brief CToolLogger
* \ brief CToolLogger
@ -104,7 +106,7 @@ public:
fflush ( m_DependLog ) ;
fflush ( m_DependLog ) ;
}
}
void writeError ( E Error type , const std : : string & path , const std : : string & error )
void writeError ( T Error type , const std : : string & path , const std : : string & error )
{
{
if ( m_ErrorLog )
if ( m_ErrorLog )
{
{
@ -132,11 +134,21 @@ public:
}
}
}
}
/// inputFile can only be file. May be not-yet-existing file for expected input for future build runs. Directories are handled on process level. You should call this before calling writeError on inputFile, so the error is also linked from the outputFile.
/// inputFile can only be file. [? May be not-yet-existing file for expected input for future build runs. ?] Directories are handled on process level. [? You should call this before calling writeError on inputFile, so the error is also linked from the outputFile. ?]
void writeDepend ( const std : : string & outputFile , const std : : string & inputFile )
void writeDepend ( TDepend type , const std : : string & outputFile , const std : : string & inputFile )
{
{
if ( m_DependLog )
if ( m_DependLog )
{
{
switch ( type )
{
case BUILD :
fwrite ( " BUILD " , 1 , 5 , m_DependLog ) ;
break ;
case RUNTIME :
fwrite ( " RUNTIME " , 1 , 7 , m_DependLog ) ;
break ;
}
fwrite ( " \t " , 1 , 1 , m_DependLog ) ;
fwrite ( outputFile . c_str ( ) , 1 , outputFile . length ( ) , m_DependLog ) ;
fwrite ( outputFile . c_str ( ) , 1 , outputFile . length ( ) , m_DependLog ) ;
fwrite ( " \t " , 1 , 1 , m_DependLog ) ;
fwrite ( " \t " , 1 , 1 , m_DependLog ) ;
fwrite ( inputFile . c_str ( ) , 1 , inputFile . length ( ) , m_DependLog ) ;
fwrite ( inputFile . c_str ( ) , 1 , inputFile . length ( ) , m_DependLog ) ;