This was breaking encapsulation. The api is more or less the same. The only purpose for breaking the error message apart like that is it allows a consistent look to the messages. (Other files coming soon.)
This commit is contained in:
@@ -227,43 +227,15 @@ void RageLog::Warn( const char *fmt, ... )
|
|||||||
Write( WRITE_TO_INFO | WRITE_LOUD, sBuff );
|
Write( WRITE_TO_INFO | WRITE_LOUD, sBuff );
|
||||||
}
|
}
|
||||||
|
|
||||||
static const char *const LogTypeNames[] = {
|
void RageLog::UserLog( const RString &sType, const RString &sElement, const char *fmt, ... )
|
||||||
"Song file",
|
|
||||||
"Course file",
|
|
||||||
"Edit file",
|
|
||||||
"Sound file",
|
|
||||||
"Graphic file",
|
|
||||||
"Cache file",
|
|
||||||
"Song",
|
|
||||||
"Theme element",
|
|
||||||
"Theme metric",
|
|
||||||
NULL, // General, not used.
|
|
||||||
};
|
|
||||||
|
|
||||||
void RageLog::UserLog( LogType lt, const RString &sPath, const char *fmt, ... )
|
|
||||||
{
|
{
|
||||||
va_list va;
|
va_list va;
|
||||||
va_start( va, fmt );
|
va_start( va, fmt );
|
||||||
RString sBuf = vssprintf( fmt, va );
|
RString sBuf = vssprintf( fmt, va );
|
||||||
va_end( va );
|
va_end( va );
|
||||||
|
|
||||||
switch( lt )
|
if( !sType.empty() )
|
||||||
{
|
sBuf = ssprintf( "%s \"%s\" %s", sType.c_str(), sElement.c_str(), sBuf.c_str() );
|
||||||
case LogType_SongFile:
|
|
||||||
case LogType_CourseFile:
|
|
||||||
case LogType_EditFile:
|
|
||||||
case LogType_SoundFile:
|
|
||||||
case LogType_GraphicFile:
|
|
||||||
case LogType_CacheFile:
|
|
||||||
case LogType_Song:
|
|
||||||
case LogType_ThemeElement:
|
|
||||||
case LogType_ThemeMetric:
|
|
||||||
sBuf = ssprintf( "%s \"%s\" %s", LogTypeNames[lt], sPath.c_str(), sBuf.c_str() );
|
|
||||||
break;
|
|
||||||
case LogType_General:
|
|
||||||
break;
|
|
||||||
DEFAULT_FAIL( lt );
|
|
||||||
}
|
|
||||||
|
|
||||||
Write( WRITE_TO_USER_LOG, sBuf );
|
Write( WRITE_TO_USER_LOG, sBuf );
|
||||||
}
|
}
|
||||||
|
|||||||
+1
-16
@@ -9,25 +9,10 @@ public:
|
|||||||
RageLog();
|
RageLog();
|
||||||
~RageLog();
|
~RageLog();
|
||||||
|
|
||||||
enum LogType
|
|
||||||
{
|
|
||||||
LogType_SongFile, // Refers to a sm, dwi, ksf, etc. file.
|
|
||||||
LogType_CourseFile, // Refers to a crs file.
|
|
||||||
LogType_EditFile, // Refers to an edit file.
|
|
||||||
LogType_SoundFile, // Refers to a .ogg, .mp3, .wav, etc. file.
|
|
||||||
LogType_GraphicFile, // Refers to a .jpg, .png, etc. file.
|
|
||||||
LogType_CacheFile, // Refers to any cache file.
|
|
||||||
LogType_Song, // Refers to an actual song (directory).
|
|
||||||
LogType_ThemeElement, // Refers to a theme element.
|
|
||||||
LogType_ThemeMetric, // Refers to a theme metric.
|
|
||||||
LogType_General, // Any other type of user log message. Ignores sPath.
|
|
||||||
NUM_LogType
|
|
||||||
};
|
|
||||||
|
|
||||||
void Trace( const char *fmt, ... ) PRINTF(2,3);
|
void Trace( const char *fmt, ... ) PRINTF(2,3);
|
||||||
void Warn( const char *fmt, ... ) PRINTF(2,3);
|
void Warn( const char *fmt, ... ) PRINTF(2,3);
|
||||||
void Info( const char *fmt, ... ) PRINTF(2,3);
|
void Info( const char *fmt, ... ) PRINTF(2,3);
|
||||||
void UserLog( LogType lt, const RString &sPath, const char *fmt, ... ) PRINTF(4,5);
|
void UserLog( const RString &sType, const RString &sElement, const char *fmt, ... ) PRINTF(4,5);
|
||||||
void Flush();
|
void Flush();
|
||||||
|
|
||||||
void MapLog( const RString &key, const char *fmt, ... ) PRINTF(3,4);
|
void MapLog( const RString &key, const char *fmt, ... ) PRINTF(3,4);
|
||||||
|
|||||||
Reference in New Issue
Block a user