emailservices/emailstore/message_store/debuglog/src/DebugLog.cpp
branchRCL_3
changeset 63 d189ee25cf9d
parent 16 4ce476e64c59
child 64 3533d4323edc
equal deleted inserted replaced
61:dcf0eedfc1a3 63:d189ee25cf9d
    23 
    23 
    24 #include <e32std.h>
    24 #include <e32std.h>
    25 #include <f32file.h>
    25 #include <f32file.h>
    26 #include <sysutil.h>
    26 #include <sysutil.h>
    27 
    27 
    28 #include "debuglog.h"
    28 #include "DebugLog.h"
    29 #include "debuglogconst.h"
    29 #include "DebugLogConst.h"
    30 
    30 
    31 // This takes a lot more memory to use, so it is defaulted to off.  If the code is crashing
    31 // This takes a lot more memory to use, so it is defaulted to off.  If the code is crashing
    32 // in DoLogLeakedObjects then uncomment this line to help find the problem.  It is most likely
    32 // in DoLogLeakedObjects then uncomment this line to help find the problem.  It is most likely
    33 // caused by a DLL that was explicitly unloaded, making the original copy of the class name
    33 // caused by a DLL that was explicitly unloaded, making the original copy of the class name
    34 // unavailable.
    34 // unavailable.
  1160 CLogFileHandler* CDebugLogTlsData::DoGetLogFileHandler( const TDesC& aDirectory, RDebugLog* aObject )
  1160 CLogFileHandler* CDebugLogTlsData::DoGetLogFileHandler( const TDesC& aDirectory, RDebugLog* aObject )
  1161     {        
  1161     {        
  1162     CLogFileHandler* handler = NULL;
  1162     CLogFileHandler* handler = NULL;
  1163     
  1163     
  1164     // Look for the log file handler for the given directory.
  1164     // Look for the log file handler for the given directory.
  1165     TInt  index = 0;
  1165     TInt index = 0;
  1166     while( index < iFiles.Count() && ( !handler ) )
  1166     while( index < iFiles.Count() && ( !handler ) )
  1167         {
  1167         {
  1168         CLogFileHandler* currentHandler = iFiles[index];
  1168         CLogFileHandler* currentHandler = iFiles[index];
  1169         if( currentHandler->IsHandler( aDirectory ) )
  1169         if( currentHandler->IsHandler( aDirectory ) )
  1170             {
  1170             {
  1180         {        
  1180         {        
  1181         handler = new CLogFileHandler( iFs, iFormatBuffer, iOutputBuffer, aDirectory, iFileName );
  1181         handler = new CLogFileHandler( iFs, iFormatBuffer, iOutputBuffer, aDirectory, iFileName );
  1182 
  1182 
  1183         if( handler )
  1183         if( handler )
  1184             {            
  1184             {            
  1185             iFiles.Append( handler );
  1185             iFiles.AppendL( handler );
  1186             } // end if
  1186             } // end if
  1187         }
  1187         }
  1188     
  1188     
  1189     if( handler )
  1189     if( handler )
  1190         {        
  1190         {        
  1192 //#ifdef __MAKE_COPY_OF_NAMES 
  1192 //#ifdef __MAKE_COPY_OF_NAMES 
  1193         HBufC8* copyOfName = HBufC8::New( aObject->ClassName8().Length() ); 
  1193         HBufC8* copyOfName = HBufC8::New( aObject->ClassName8().Length() ); 
  1194 		if ( copyOfName )
  1194 		if ( copyOfName )
  1195 		    {       
  1195 		    {       
  1196             copyOfName->Des().Copy( aObject->ClassName8() );
  1196             copyOfName->Des().Copy( aObject->ClassName8() );
  1197             handler->iObjectNames.Append( copyOfName );
  1197             handler->iObjectNames.AppendL( copyOfName );
  1198 			}
  1198 			}
  1199 //#endif        
  1199 //#endif        
  1200 
  1200 
  1201         handler->iObjects.Append( aObject );
  1201         handler->iObjects.AppendL( aObject );
  1202 	    } // end if
  1202 	    } // end if
  1203 	    
  1203 	    
  1204 	return handler;       
  1204 	return handler;       
  1205     
  1205     
  1206     } // END DoGetLogFileHandler
  1206     } // END DoGetLogFileHandler
  1210 //
  1210 //
  1211 // DESIGN:  
  1211 // DESIGN:  
  1212 // ==========================================================================
  1212 // ==========================================================================
  1213 void CDebugLogTlsData::DoReleaseLogFileHandler( CLogFileHandler* aHandler, RDebugLog* aObject )
  1213 void CDebugLogTlsData::DoReleaseLogFileHandler( CLogFileHandler* aHandler, RDebugLog* aObject )
  1214     {
  1214     {
  1215     TInt index = aHandler->iObjects.Find( aObject );
  1215     TInt index = aHandler->iObjects.FindL( aObject );
  1216     
  1216     
  1217     if( index >= 0 )
  1217     if( index >= 0 )
  1218         {
  1218         {
  1219 //#ifdef __MAKE_COPY_OF_NAMES
  1219 //#ifdef __MAKE_COPY_OF_NAMES
  1220         delete aHandler->iObjectNames[index];
  1220         delete aHandler->iObjectNames[index];