diff -r acef663c1218 -r b73a2e62868f metadataengine/server/src/mdsimportexport.cpp --- a/metadataengine/server/src/mdsimportexport.cpp Tue Jan 26 12:13:20 2010 +0200 +++ b/metadataengine/server/src/mdsimportexport.cpp Tue Feb 02 00:24:33 2010 +0200 @@ -51,10 +51,12 @@ const TInt KMdsMaxUriLenght = KMaxFileName; const TChar KMdsLineFeed = '\n'; +#ifdef _DEBUG const TInt KMdsMaxLogLineLenght( 2056 ); _LIT( KMdsErrorLogDirectory, "Metadata" ); _LIT( KMdsErrorLogFilename, "importerror.log" ); +#endif // keyword definitions in import file _LIT8( KMdsKeywordComment, "//" ); @@ -117,8 +119,13 @@ { delete iConverter; - iLog.CloseLog(); - iLog.Close(); +#ifdef _DEBUG + if( iLogEnabled ) + { + iLog.CloseLog(); + iLog.Close(); + } +#endif iFs.Close(); delete iBuffer; @@ -136,10 +143,16 @@ User::LeaveIfError( iFs.Connect() ); iConverter->PrepareToConvertToOrFromL( KCharacterSetIdentifierUtf8, iFs ); - - User::LeaveIfError( iLog.Connect( ) ); - iLog.CreateLog( KMdsErrorLogDirectory, KMdsErrorLogFilename, EFileLoggingModeOverwrite ); - iLog.SetDateAndTime(EFalse, ETrue); + +#ifdef _DEBUG + const TInt logError( iLog.Connect( ) ); + if( logError == KErrNone ) + { + iLogEnabled = ETrue; + iLog.CreateLog( KMdsErrorLogDirectory, KMdsErrorLogFilename, EFileLoggingModeOverwrite ); + iLog.SetDateAndTime(EFalse, ETrue); + } +#endif iBuffer = NULL; iLastObjectDef = NULL; @@ -2474,19 +2487,28 @@ // LogError // ------------------------------------------------ // +#ifdef _DEBUG void CMdsImportExport::LogError( const TDesC& aMessage ) { - _LIT( KParseError, "Parse error: %S" ); - _LIT( KCurrentFile, "Current file: %S" ); - _LIT( KCurrentLineNum, "Current line number: %d" ); - _LIT( KCurrentLine, "Current line: %S" ); - iLog.WriteFormat( KParseError, &aMessage ); - iLog.WriteFormat( KCurrentFile, &iFileName ); - iLog.WriteFormat( KCurrentLineNum, iLineNumber ); - TBuf16 line16; - Conv8To16( iLine, line16 ); - iLog.WriteFormat( KCurrentLine, &line16 ); + if( iLogEnabled ) + { + _LIT( KParseError, "Parse error: %S" ); + _LIT( KCurrentFile, "Current file: %S" ); + _LIT( KCurrentLineNum, "Current line number: %d" ); + _LIT( KCurrentLine, "Current line: %S" ); + iLog.WriteFormat( KParseError, &aMessage ); + iLog.WriteFormat( KCurrentFile, &iFileName ); + iLog.WriteFormat( KCurrentLineNum, iLineNumber ); + TBuf16 line16; + Conv8To16( iLine, line16 ); + iLog.WriteFormat( KCurrentLine, &line16 ); + } } +#else +void CMdsImportExport::LogError( const TDesC& /*aMessage*/ ) + { + } +#endif // ------------------------------------------------