realtimenetprots/sipfw/ProfileAgent/Profile/Inc/SipProfileLog.inl
changeset 55 36ea1f90a3d8
parent 17 bfe1f539b721
--- a/realtimenetprots/sipfw/ProfileAgent/Profile/Inc/SipProfileLog.inl	Tue Oct 19 05:33:24 2010 +0530
+++ b/realtimenetprots/sipfw/ProfileAgent/Profile/Inc/SipProfileLog.inl	Thu Oct 21 15:53:21 2010 +0530
@@ -20,151 +20,38 @@
 *
 */
 
-
-#include <flogger.h>
-
-#include <e32base.h>
-#include <bautils.h>
-#include <utf.h>
-
-_LIT(KSipLogFileDir, "Sip");
-_LIT(KSipLogFileName, "SipLog.txt");
-_LIT(KSipLogPath, "C:\\logs\\sip\\");
-_LIT(KSeparator, "---------------");
-
 inline void TSIPProfileDebug::Print(const TDesC16& aStr) 
 	{
-	_LIT(KProfileFormat, "SIPProfile: %S");
-	TBuf<256> str;
-
-	str.Format(KProfileFormat, &aStr);
-		
-	WriteLog( str );
+    OstTraceExt1( TRACE_NORMAL, TSIPPROFILEDEBUG_PRINT, "SIPProfile: %S", aStr );
 	}
 
 
 inline void TSIPProfileDebug::Print(const TDesC16& aStr1, const TDesC16& aStr2) 
 	{
-	_LIT(KProfileFormat, "SIPProfile: %S, %S");
-	TBuf<256> str;
-
-	str.Format(KProfileFormat, &aStr1, &aStr2);
-		
-	WriteLog( str );
+    OstTraceExt2( TRACE_NORMAL, TSIPPROFILEDEBUG_PRINT_TWO_ARG, "SIPProfile: %S, %S", aStr1, aStr2 );
 	}
 
 
 inline void TSIPProfileDebug::Print(const TDesC16& aStr, TUint32 aValue) 
 	{
-	_LIT(KProfileFormat, "SIPProfile: %S, %d");
-	TBuf<256> str;
-
-	str.Format(KProfileFormat, &aStr, aValue);
-		
-	WriteLog( str );
+    OstTraceExt2( TRACE_NORMAL, DUP1_TSIPPROFILEDEBUG_PRINT, "SIPProfile: %S, %u", aStr, aValue );
 	}
 
 inline void TSIPProfileDebug::Print(const TDesC16& aStr, TUint32 aValue1,
 	TUint32 aValue2) 
 	{
-	_LIT(KProfileFormat, "SIPProfile: %S, %d, %d");
-	TBuf<256> str;
-
-	str.Format(KProfileFormat, &aStr, aValue1, aValue2);
-		
-	WriteLog( str );
+    OstTraceExt3( TRACE_NORMAL, DUP2_TSIPPROFILEDEBUG_PRINT, "SIPProfile: %S, %u, %u", aStr, aValue1, aValue2 );
 	}
 
 
 inline void TSIPProfileDebug::Print(const TDesC16& aStr, TUint32 aValue1, 
 	TUint32 aValue2, TUint32 aValue3) 
 	{
-	_LIT(KProfileFormat, "SIPProfile: %S, %d, %d, %d");
-	TBuf<256> str;
-
-	str.Format(KProfileFormat, &aStr, aValue1, aValue2, aValue3);
-		
-	WriteLog( str );
+    OstTraceExt4( TRACE_NORMAL, DUP3_TSIPPROFILEDEBUG_PRINT, "SIPProfile: %S, %u, %u, %u", aStr, aValue1, aValue2, aValue3 );
 	}
 
 
 inline void TSIPProfileDebug::Print(const TDesC16& aStr1, const TDesC8& aStr2) 
 	{
-	_LIT(KProfileFormat, "SIPProfile: %S, %S");
-	TBuf<100> str2;
-	CnvUtfConverter::ConvertToUnicodeFromUtf8(str2, aStr2);
-	TBuf<256> str;
-
-	str.Format(KProfileFormat, &aStr1, &str2);
-		
-	WriteLog( str );
+    OstTraceExt2( TRACE_NORMAL, DUP4_TSIPPROFILEDEBUG_PRINT, "SIPProfile: %S, %s", aStr1, aStr2 );
 	}
-
-inline TBool TSIPProfileDebug::LogDirExists( const TDesC& aFolderName )
-	{
-	RFs fs;
-	TInt ret = fs.Connect();
-	
-	if ( ret != KErrNone )
-		{
-		fs.Close();
-		return EFalse;
-		}
-	
-	if ( aFolderName.Length() == 0 )
-		{
-		fs.Close();
-		return EFalse;
-		}
-	
-	TParse parse;
-	
-	TInt retcode = parse.SetNoWild( aFolderName, NULL, NULL );
- 	
-	if ( retcode != KErrNone )
-		{
-		fs.Close();
-		return EFalse;
-		}
- 			
-	if ( parse.NameOrExtPresent() )
-		{
-		if ( !fs.IsValidName( aFolderName ) )
-			{
-			fs.Close();
-			return EFalse;
-			}
-		}
- 	
-	TPtrC dirName = parse.DriveAndPath();
-	RDir dir;
-	retcode = dir.Open( fs, dirName, 0 );
-	
-	if ( retcode == KErrNone )
-		{
-		dir.Close();
-		}
-	fs.Close();
-	
-	return ( retcode == KErrNone );
-	}
-
-inline void TSIPProfileDebug::WriteToFile( const TDesC& aStr )
-	{
-	RFileLogger::Write ( KSipLogFileDir, KSipLogFileName, 
-		EFileLoggingModeAppend, aStr );
-	RFileLogger::Write (KSipLogFileDir, KSipLogFileName, 
-		EFileLoggingModeAppend, KSeparator);		
-	}
-	
-inline void TSIPProfileDebug::WriteLog( const TDesC& aStr )
-	{
-	if ( LogDirExists( KSipLogPath ) )
-		{
-		WriteToFile( aStr );
-		}
-	else
-		{
-		RDebug::RawPrint( aStr );
-		}
-	}