Author: sh-sh-sh Date: Fri Apr 4 15:12:18 2008 New Revision: 46101 URL: http://svn.opensuse.org/viewcvs/yast?rev=46101&view=rev Log: don't log source file name with complete path Modified: trunk/libyui/src/YUILog.cc trunk/libyui/src/YUILog.h Modified: trunk/libyui/src/YUILog.cc URL: http://svn.opensuse.org/viewcvs/yast/trunk/libyui/src/YUILog.cc?rev=46101&am... ============================================================================== --- trunk/libyui/src/YUILog.cc (original) +++ trunk/libyui/src/YUILog.cc Fri Apr 4 15:12:18 2008 @@ -139,7 +139,7 @@ string line = buffer.substr( start, newline_pos - start ); loggerFunction( logLevel, logComponent, - sourceFileName, lineNo, functionName, + YUILog::basename( sourceFileName ).c_str(), lineNo, functionName, line.c_str() ); start = newline_pos + 1; @@ -506,6 +506,22 @@ } + +string +YUILog::basename( const string & fileNameWithPath ) +{ + std::size_t lastSlashPos = fileNameWithPath.find_last_of( '/' ); + + string fileName = + ( lastSlashPos == string::npos ) ? + fileNameWithPath : + fileNameWithPath.substr( lastSlashPos+1 ); + + return fileName; +} + + + static void stdLogger( YUILogLevel_t logLevel, const char * logComponent, Modified: trunk/libyui/src/YUILog.h URL: http://svn.opensuse.org/viewcvs/yast/trunk/libyui/src/YUILog.h?rev=46101&... ============================================================================== --- trunk/libyui/src/YUILog.h (original) +++ trunk/libyui/src/YUILog.h Fri Apr 4 15:12:18 2008 @@ -207,6 +207,11 @@ **/ static YUIDebugLoggingEnabledFunction debugLoggingEnabledHook(); + /** + * Return the base name without path from a file name with path. + **/ + static string basename( const string & fileNameWithPath ); + private: /** -- To unsubscribe, e-mail: yast-commit+unsubscribe@opensuse.org For additional commands, e-mail: yast-commit+help@opensuse.org