phoneapp/phoneuiutils/src/cphoneLogger.cpp
changeset 37 ba76fc04e6c2
child 51 f39ed5e045e0
equal deleted inserted replaced
36:2eacb6118286 37:ba76fc04e6c2
       
     1 /*
       
     2 * Copyright (c) 2005 Nokia Corporation and/or its subsidiary(-ies). 
       
     3 * All rights reserved.
       
     4 * This component and the accompanying materials are made available
       
     5 * under the terms of "Eclipse Public License v1.0"
       
     6 * which accompanies this distribution, and is available
       
     7 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
     8 *
       
     9 * Initial Contributors:
       
    10 * Nokia Corporation - initial contribution.
       
    11 *
       
    12 * Contributors:
       
    13 *
       
    14 * Description: Implementation of CPhoneLogger class.
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 // INCLUDE FILES
       
    20 // System includes
       
    21 #include <f32file.h> // for TParse, in Flogger stuff
       
    22 #include <flogger.h>
       
    23 #include <pevirtualengine.h>
       
    24 #include <featmgr.h>        // for FeatureManager
       
    25 
       
    26 #include "phoneconstants.h"
       
    27 #include "phonelogger.h"
       
    28 
       
    29 // Local includes
       
    30 #include "phonestatestrings.h" // also includes StringPool.h
       
    31 #include "phonestatestringsgsm.h" // also includes StringPool.h
       
    32 #include "phoneloggerviewcommands.h" // also includes StringPool.h
       
    33 #include "phoneui.pan"
       
    34 
       
    35 // Class signature
       
    36 #include "cphonelogger.h"
       
    37 
       
    38 // ============================ MEMBER FUNCTIONS ===============================
       
    39 
       
    40 // -----------------------------------------------------------------------------
       
    41 // CPhoneLogger::CPhoneLogger
       
    42 // C++ default constructor can NOT contain any code, that
       
    43 // might leave.
       
    44 // Constructed with destructionPriority = -1, CPhoneLogger will then be 
       
    45 // destroyed after the CCoeAppUi object is destroyed.
       
    46 // -----------------------------------------------------------------------------
       
    47 //
       
    48 EXPORT_C CPhoneLogger::CPhoneLogger( TUid aUid ) : CCoeStatic( aUid, -1 )
       
    49     {
       
    50     // Logging levels for each component is setted here
       
    51     iLogLevelArray[ EPhoneAbstractFactoryClient ] = ENo;
       
    52     iLogLevelArray[ EPhoneControl ] = EAll;
       
    53     iLogLevelArray[ EPhonePhoneapp ] = EAll;
       
    54     iLogLevelArray[ EPhoneUIStates ] = EAll;
       
    55     iLogLevelArray[ EPhoneUIView ] = EAll;
       
    56     iLogLevelArray[ EPhoneUIUtils ] = EAll;
       
    57     iLogLevelArray[ PhoneUIVoIPExtension ] = EAll;
       
    58     iLogLevelArray[ EPhoneMediatorCenter ] = EAll;
       
    59     }
       
    60 
       
    61 
       
    62 // Destructor
       
    63 EXPORT_C
       
    64 CPhoneLogger::~CPhoneLogger()
       
    65     {
       
    66 #if (PHONEUI_LOGGING_OUTPUT == RDEBUG_LOGGING || PHONEUI_LOGGING_OUTPUT == FILE_LOGGING)
       
    67     iPool.Close();
       
    68 #endif
       
    69     }
       
    70 
       
    71 // -----------------------------------------------------------------------------
       
    72 // CPhoneLogger::CheckLogLevel
       
    73 // Checks if component that tries to log has big enough log level.
       
    74 // -----------------------------------------------------------------------------
       
    75 //
       
    76 TBool CPhoneLogger::CheckLogLevel(
       
    77     TPhoneUILoggingLevel aLevel, 
       
    78     TPhoneUILoggingComponent aLoggingComponent )
       
    79     {
       
    80         __ASSERT_DEBUG( aLoggingComponent < iLogLevelArray.Count(),
       
    81         Panic( EPhoneUtilsIndexOutOfBounds ) );
       
    82         
       
    83     return ( aLevel <= iLogLevelArray[aLoggingComponent] );
       
    84     }
       
    85 
       
    86 // -----------------------------------------------------------------------------
       
    87 // CPhoneLogger::LogIt
       
    88 // Messages to the log file.
       
    89 // -----------------------------------------------------------------------------
       
    90 //
       
    91 #if (PHONEUI_LOGGING_OUTPUT == RDEBUG_LOGGING || PHONEUI_LOGGING_OUTPUT == FILE_LOGGING)
       
    92 void CPhoneLogger::LogIt( TRefByValue<const TDesC> aFmt, ...)
       
    93     {
       
    94     VA_LIST list;
       
    95     VA_START( list, aFmt );
       
    96 
       
    97     TBuf<KMaxLogLineLength> buf;
       
    98 
       
    99     buf.AppendFormatList( aFmt, list, this );
       
   100     VA_END( list );
       
   101 
       
   102     WriteComment( buf );
       
   103 
       
   104     }
       
   105 #else 
       
   106 void CPhoneLogger::LogIt( TRefByValue<const TDesC> /*aFmt*/, ...) {}
       
   107 #endif
       
   108 
       
   109 // -----------------------------------------------------------------------------
       
   110 // CPhoneLogger::LogIt
       
   111 // Writes messages to the log.
       
   112 // -----------------------------------------------------------------------------
       
   113 //
       
   114 #if (PHONEUI_LOGGING_OUTPUT == RDEBUG_LOGGING || PHONEUI_LOGGING_OUTPUT == FILE_LOGGING)
       
   115 EXPORT_C void CPhoneLogger::LogIt(
       
   116     TPhoneUILoggingLevel aLevel, 
       
   117     TPhoneUILoggingComponent aLoggingComponent, 
       
   118     TRefByValue<const TDesC> aFmt, ...)
       
   119     {
       
   120     if ( this == NULL ) return;
       
   121     if ( CheckLogLevel( aLevel, aLoggingComponent ) )
       
   122         {
       
   123         VA_LIST list;
       
   124         VA_START( list, aFmt );
       
   125 
       
   126         TBuf<KMaxLogLineLength> buf;
       
   127 
       
   128         buf.AppendFormatList( aFmt, list, this );
       
   129         VA_END( list );
       
   130 
       
   131         WriteComment( buf );  
       
   132         }   
       
   133     }
       
   134 #else 
       
   135 EXPORT_C void CPhoneLogger::LogIt(
       
   136     TPhoneUILoggingLevel /*aLevel*/, 
       
   137     TPhoneUILoggingComponent, 
       
   138     TRefByValue<const TDesC> /*aFmt*/, ...) {}
       
   139 #endif
       
   140 
       
   141 // -----------------------------------------------------------------------------
       
   142 // CPhoneLogger::WriteComment
       
   143 // Do a write of the supplied data, literally where possible
       
   144 // -----------------------------------------------------------------------------
       
   145 //
       
   146 #if (PHONEUI_LOGGING_OUTPUT == RDEBUG_LOGGING || PHONEUI_LOGGING_OUTPUT == FILE_LOGGING)
       
   147 void CPhoneLogger::WriteComment( const TDesC& aComment )
       
   148     {
       
   149 #if ( PHONEUI_LOGGING_OUTPUT == RDEBUG_LOGGING )
       
   150     RDebug::Print( aComment );
       
   151 #endif
       
   152 #if (PHONEUI_LOGGING_OUTPUT == FILE_LOGGING)
       
   153     RFileLogger::Write( 
       
   154         KPhoneLogFolder(),
       
   155         KPhoneLogFileName(),
       
   156         EFileLoggingModeAppend,
       
   157         aComment);
       
   158 #endif
       
   159     }
       
   160 // Logging method == 0 (no logging at all) is handled so
       
   161 // that no code is generated at all.
       
   162 #else 
       
   163 void CPhoneLogger::WriteComment( const TDesC& )
       
   164 {
       
   165 //TInt test;
       
   166 }
       
   167 #endif
       
   168 
       
   169 // -----------------------------------------------------------------------------
       
   170 // CPhoneLogger::Overflow
       
   171 // Implements overflow handler derived from TDes16Overflow. 
       
   172 // Used by TDes16::AppendFormatList().
       
   173 // -----------------------------------------------------------------------------
       
   174 //
       
   175 EXPORT_C
       
   176 #if (PHONEUI_LOGGING_OUTPUT == RDEBUG_LOGGING || PHONEUI_LOGGING_OUTPUT == FILE_LOGGING)
       
   177 void CPhoneLogger::Overflow( TDes16& aDes )
       
   178     {
       
   179     // Overflow has occured - end log line with '...'
       
   180     _LIT( KErrOverflowMsg, "..." );
       
   181     if ( aDes.MaxLength() >= KErrOverflowMsg().Length() + aDes.Length() )
       
   182         {
       
   183         aDes.Append( KErrOverflowMsg );
       
   184         }
       
   185     }
       
   186 #else
       
   187 void CPhoneLogger::Overflow( TDes& ) {}
       
   188 #endif
       
   189 
       
   190 // -----------------------------------------------------------------------------
       
   191 // CPhoneLogger::LogMsgFromPhoneUIToPE
       
   192 // LogPECommand: 
       
   193 // Creates a PE specified log message by given command and 
       
   194 // call id and writes it in the log file.
       
   195 //
       
   196 // NOTE:
       
   197 //  If You make changes to enum TPACommandId, please do same 
       
   198 //  changes to paloggermessagestophoneenginestrings.st and run abld 
       
   199 //  makefile.
       
   200 //
       
   201 // -----------------------------------------------------------------------------
       
   202 //
       
   203 EXPORT_C
       
   204 #if (PHONEUI_LOGGING_OUTPUT == RDEBUG_LOGGING || PHONEUI_LOGGING_OUTPUT == FILE_LOGGING)
       
   205 void CPhoneLogger::LogMsgFromPhoneUIToPE( 
       
   206     const TInt aMessage, 
       
   207     const TInt /*aCallId*/ )
       
   208     {
       
   209     // Log only if logging level for control is big enough.
       
   210     if ( iLogLevelArray[EPhoneControl] >= EBasic )
       
   211         {   
       
   212         TBuf<KMaxAppendLength> buf;
       
   213         GetPhoneUIToPEStringById( buf, aMessage );
       
   214         LogIt( KPEDefaultMsgToPE, &buf );
       
   215         }
       
   216     }
       
   217 
       
   218 #else
       
   219 void CPhoneLogger::LogMsgFromPhoneUIToPE( const TInt, const TInt ) {}
       
   220 #endif //_DEBUG
       
   221 
       
   222 
       
   223 // -----------------------------------------------------------------------------
       
   224 // CPhoneLogger::LogMsgFromControlToView
       
   225 // -----------------------------------------------------------------------------
       
   226 //
       
   227 EXPORT_C
       
   228 #if (PHONEUI_LOGGING_OUTPUT == RDEBUG_LOGGING || PHONEUI_LOGGING_OUTPUT == FILE_LOGGING)
       
   229 void CPhoneLogger::LogMsgFromControlToView(
       
   230     const TInt aMessage, 
       
   231     const TInt /*aCallId*/ )
       
   232     {
       
   233     // Log only if logging level for Phoneapp is big enough.
       
   234     if ( iLogLevelArray[EPhoneUIView] >= EBasic )
       
   235         {   
       
   236         TBuf<KMaxAppendLength> buf;
       
   237         GetPhoneUIToViewStringById( buf, aMessage );
       
   238         LogIt( KPEDefaultMsgToView, &buf );
       
   239         }
       
   240     }
       
   241 
       
   242 #else
       
   243 // -----------------------------------------------------------------------------
       
   244 // CPhoneLogger::LogMsgFromControlToView
       
   245 // -----------------------------------------------------------------------------
       
   246 //
       
   247 void CPhoneLogger::LogMsgFromControlToView( const TInt, const TInt ) {}
       
   248 #endif //_DEBUG
       
   249 
       
   250 // -----------------------------------------------------------------------------
       
   251 // CPhoneLogger::LogStateChange
       
   252 // Writes state chage to log file
       
   253 // -----------------------------------------------------------------------------
       
   254 //
       
   255 EXPORT_C
       
   256 #if (PHONEUI_LOGGING_OUTPUT == RDEBUG_LOGGING || PHONEUI_LOGGING_OUTPUT == FILE_LOGGING)
       
   257 void CPhoneLogger::LogStateChange( 
       
   258     const TInt aCurrentState, 
       
   259     const TInt aNewState )
       
   260     {
       
   261     // Log only if logging level for Phone UI control is big enough.
       
   262     if ( ( iLogLevelArray[EPhoneControl] >= EBasic ) ||
       
   263         ( iLogLevelArray[EPhoneUIStates] >= EBasic ) )
       
   264         {           
       
   265         TBuf<KMaxAppendLength> currentState;
       
   266         TBuf<KMaxAppendLength> newState;
       
   267         
       
   268         GetStateName( currentState, aCurrentState );
       
   269         GetStateName( newState, aNewState );
       
   270         
       
   271         LogIt( KPEDefaultStateChange, &currentState, &newState );
       
   272         }
       
   273     }
       
   274 
       
   275 #else
       
   276 void CPhoneLogger::LogStateChange( const TInt, const TInt ) {}
       
   277 #endif //_DEBUG
       
   278 
       
   279 // -----------------------------------------------------------------------------
       
   280 // CPhoneLogger::LogMsgFromPEToPhoneUI
       
   281 // LogPEMessage: 
       
   282 // Creates a PE specified log message by given parameters 
       
   283 // and writes it in the log file.
       
   284 //
       
   285 // NOTE:
       
   286 //  If You make changes to enum TPEMessagesFromPhoneEngine, please do same 
       
   287 //  changes to phoneloggermessagesfromphoneenginestrings.st and run abld 
       
   288 //  makefile.
       
   289 //
       
   290 // -----------------------------------------------------------------------------
       
   291 //
       
   292 EXPORT_C
       
   293 #if (PHONEUI_LOGGING_OUTPUT == RDEBUG_LOGGING || PHONEUI_LOGGING_OUTPUT == FILE_LOGGING)
       
   294 void CPhoneLogger::LogMsgFromPEToPhoneUI( 
       
   295     const TInt aMessage, 
       
   296     const TInt aCallId  )
       
   297     {
       
   298     // Log only if logging level for application control is big enough.
       
   299     if ( iLogLevelArray[EPhoneControl] >= EBasic )
       
   300         {          
       
   301         TBuf<KMaxAppendLength> buf;
       
   302         GetPEToPhoneUIStringById( buf, aMessage );
       
   303         LogIt( KPEDefaultMsgToPhoneUI, &buf, aCallId );
       
   304         }
       
   305     }
       
   306 
       
   307 #else
       
   308 void CPhoneLogger::LogMsgFromPEToPhoneUI ( const TInt, const TInt ) {}
       
   309 #endif //_DEBUG
       
   310 
       
   311 // -----------------------------------------------------------------------------
       
   312 // CPhoneLogger::LogMsgFromPEToPhoneUIEnd
       
   313 // -----------------------------------------------------------------------------
       
   314 //
       
   315 EXPORT_C
       
   316 #if (PHONEUI_LOGGING_OUTPUT == RDEBUG_LOGGING || PHONEUI_LOGGING_OUTPUT == FILE_LOGGING)
       
   317 void CPhoneLogger::LogMsgFromPEToPhoneUIEnd( const TInt aMessage )
       
   318     {
       
   319     // Log only if logging level for application control is big enough.
       
   320     if ( iLogLevelArray[EPhoneControl] >= EBasic )
       
   321         {           
       
   322         TBuf<KMaxAppendLength> buf;
       
   323         GetPEToPhoneUIStringById( buf, aMessage );
       
   324         LogIt( KPEDefaultMsgToPhoneUIEnd, &buf );
       
   325         }
       
   326     }
       
   327 
       
   328 #else
       
   329 void CPhoneLogger::LogMsgFromPEToPhoneUIEnd ( const TInt ) {}
       
   330 #endif //_DEBUG
       
   331 
       
   332 
       
   333 // -----------------------------------------------------------------------------
       
   334 // CPhoneLogger::GetPEToPhoneUIStringById
       
   335 // Provides string representation for TPEMessagesFromPhoneEngine enums by 
       
   336 // ordinal number.
       
   337 //
       
   338 // NOTE:
       
   339 //  If You make changes to enum TPEMessagesFromPhoneEngine, please do same 
       
   340 //  changes to phoneloggermessagesfromphoneenginestrings.st and run abld 
       
   341 //  makefile.
       
   342 //
       
   343 // -----------------------------------------------------------------------------
       
   344 //
       
   345 #if (PHONEUI_LOGGING_OUTPUT == RDEBUG_LOGGING || PHONEUI_LOGGING_OUTPUT == FILE_LOGGING)
       
   346 void CPhoneLogger::GetPEToPhoneUIStringById( TDes16& aDes, const TInt aID )
       
   347     {
       
   348     ASSERT( iPhoneEngine );
       
   349     aDes.Copy( iPhoneEngine->NameByMessageFromPhoneEngine( aID ) );
       
   350     }
       
   351 
       
   352 #else
       
   353 void CPhoneLogger::GetPEToPhoneUIStringById( TDes16& , const TInt ) {}
       
   354 #endif //_DEBUG
       
   355 
       
   356 
       
   357 // -----------------------------------------------------------------------------
       
   358 // CPhoneLogger::GetStateName
       
   359 // -----------------------------------------------------------------------------
       
   360 //
       
   361 #if (PHONEUI_LOGGING_OUTPUT == RDEBUG_LOGGING || PHONEUI_LOGGING_OUTPUT == FILE_LOGGING)
       
   362 void CPhoneLogger::GetStateName( TDes16& aDes, const TInt aID )
       
   363     {
       
   364     TStringTable table;
       
   365     TInt stateID;
       
   366     if ( aID < KPhoneStateProtocolFirst )
       
   367         {
       
   368         table = PhoneStateStrings::Table;
       
   369         stateID = aID;
       
   370         }
       
   371     else 
       
   372         {
       
   373         stateID = aID - KPhoneStateProtocolFirst;
       
   374 
       
   375         if ( FeatureManager::FeatureSupported( KFeatureIdProtocolGsm ) ||
       
   376             FeatureManager::FeatureSupported( KFeatureIdProtocolWcdma ) )
       
   377             {
       
   378             table = PhoneStateStringsGSM::Table;
       
   379             }
       
   380         }
       
   381 
       
   382     TRAPD( err, iPool.OpenL( table ) );
       
   383     if ( err == KErrNone )
       
   384         {
       
   385         aDes.Copy( iPool.StringF( stateID, table ).DesC() );
       
   386         iPool.Close();
       
   387         }
       
   388 
       
   389     if ( ( aDes.Length() == 0 ) || ( err != KErrNone ) )
       
   390         {
       
   391         aDes.AppendNum( (TInt)aID );
       
   392         }
       
   393     }
       
   394 
       
   395 #else
       
   396 void CPhoneLogger::GetStateName( TDes16& , const TInt ) {}
       
   397 #endif //_DEBUG
       
   398 /*
       
   399 // ==========================================================
       
   400 // GetViewName: 
       
   401 // Appends view name to given buf.
       
   402 //
       
   403 // ==========================================================
       
   404 #if (PHONEUI_LOGGING_OUTPUT == 1 || PHONEUI_LOGGING_OUTPUT == 2)
       
   405 void CPhoneLogger::GetViewName( TDes16& aDes, const TInt aID )
       
   406     {
       
   407     TRAPD( err, iPool->OpenL( PhoneUIViewStrings::Table ) );
       
   408     if( err == KErrNone )
       
   409         {
       
   410         aDes.Copy(iPool->StringF( aID, PAViewStrings::Table ).DesC());
       
   411         iPool->Close();
       
   412         }
       
   413 
       
   414     if( ( aDes.Length() == 0 ) || ( err != KErrNone ) )
       
   415         {
       
   416         aDes.AppendNum( (TInt)aID );                                                                                            
       
   417         }
       
   418     }
       
   419 
       
   420 #else
       
   421 void CPhoneLogger::GetViewName( TDes16& , const TInt ) {}
       
   422 #endif //_DEBUG
       
   423 */
       
   424 
       
   425 // -----------------------------------------------------------------------------
       
   426 // CPhoneLogger::GetPhoneUIToPEStringById
       
   427 // Provides string representation for TPACommandId enums by 
       
   428 // ordinal number.
       
   429 //
       
   430 // NOTE:
       
   431 //  If You make changes to enum TPACommandId, please do same 
       
   432 //  changes to paloggermessagestophoneenginestrings.st and run abld 
       
   433 //  makefile.
       
   434 //
       
   435 // -----------------------------------------------------------------------------
       
   436 //
       
   437 #if (PHONEUI_LOGGING_OUTPUT == RDEBUG_LOGGING || PHONEUI_LOGGING_OUTPUT == FILE_LOGGING)
       
   438 void CPhoneLogger::GetPhoneUIToPEStringById( TDes16& aDes, const TInt aID )
       
   439     {
       
   440     ASSERT( iPhoneEngine );
       
   441     aDes.Copy( iPhoneEngine->NameByMessageToPhoneEngine( aID ) );
       
   442     }
       
   443 
       
   444 #else
       
   445 void CPhoneLogger::GetPhoneUIToPEStringById( TDes16& , const TInt ) {}
       
   446 #endif //_DEBUG
       
   447 
       
   448 // -----------------------------------------------------------------------------
       
   449 // CPhoneLogger::GetPhoneUIToViewStringById
       
   450 // Provides string representation for TPACommandId enums by 
       
   451 // ordinal number.
       
   452 //
       
   453 // NOTE:
       
   454 //  If You make changes to enum TPACommandId, please do same 
       
   455 //  changes to paloggermessagestophoneenginestrings.st and run abld 
       
   456 //  makefile.
       
   457 //
       
   458 // -----------------------------------------------------------------------------
       
   459 //
       
   460 #if (PHONEUI_LOGGING_OUTPUT == RDEBUG_LOGGING || PHONEUI_LOGGING_OUTPUT == FILE_LOGGING)
       
   461 void CPhoneLogger::GetPhoneUIToViewStringById( TDes16& aDes, const TInt aID )
       
   462     {
       
   463     TRAPD( err, iPool.OpenL( PhoneLoggerviewCommands::Table ) );
       
   464     if ( err == KErrNone )
       
   465         {
       
   466         aDes.Copy( iPool.StringF( aID, 
       
   467             PhoneLoggerviewCommands::Table ).DesC() );
       
   468         iPool.Close();
       
   469         }
       
   470 
       
   471     if ( ( aDes.Length() == 0 ) || ( err != KErrNone ) )
       
   472         {
       
   473         aDes.AppendNum( (TInt)aID );
       
   474         }
       
   475     }
       
   476 
       
   477 #else
       
   478 void CPhoneLogger::GetPhoneUIToViewStringById( TDes16& , const TInt ) {}
       
   479 #endif //_DEBUG
       
   480 
       
   481 // ---------------------------------------------------------
       
   482 // CPhoneLogger::SetPhoneEngine
       
   483 // ---------------------------------------------------------
       
   484 //
       
   485 EXPORT_C void CPhoneLogger::SetPhoneEngine( 
       
   486     MPEPhoneModel* aPhoneEngine )
       
   487     {
       
   488     iPhoneEngine = aPhoneEngine;
       
   489     }
       
   490 
       
   491 // -----------------------------------------------------------------------------
       
   492 // CPhoneLogger::CPhoneMethodLogger
       
   493 // Method logger contructor. Logs method start.
       
   494 // -----------------------------------------------------------------------------
       
   495 //
       
   496 EXPORT_C CPhoneMethodLogger::CPhoneMethodLogger(
       
   497     TPhoneUILoggingComponent aLoggingComponent, 
       
   498     TPtrC aString )
       
   499     {
       
   500     iLoggingComponent = aLoggingComponent;
       
   501     iString = aString;
       
   502     TBuf<KMaxLogLineLength> str;
       
   503     switch( iLoggingComponent )
       
   504         {
       
   505         case EPhoneControl:
       
   506             str.Append( KPhoneUIControl );
       
   507             break;
       
   508         
       
   509         case EPhonePhoneapp:
       
   510             str.Append( KPhoneUI );
       
   511             break;
       
   512             
       
   513         case EPhoneUIView:
       
   514             str.Append( KPhoneUIView );
       
   515             break;
       
   516             
       
   517         case EPhoneUIStates:
       
   518             str.Append( KPhoneUIStates );
       
   519             break;
       
   520             
       
   521         case EPhoneUIUtils:
       
   522             str.Append( KPhoneUIUtils );
       
   523             break;
       
   524 
       
   525         case EPhoneMediatorCenter:
       
   526             str.Append( KPhoneMediatorCenter );
       
   527             break;
       
   528                         
       
   529         default:
       
   530             break;
       
   531         }
       
   532         
       
   533     str.Append( iString );
       
   534     str.Append( KLessThan );
       
   535     
       
   536     CPhoneLogger * logger = static_cast<CPhoneLogger*>(
       
   537         CCoeEnv::Static( KUidPhoneUILoggerSingleton ) );
       
   538     if ( logger )
       
   539         {
       
   540         logger->LogIt( EMethodStartEnd, iLoggingComponent, str );
       
   541         }
       
   542     }
       
   543 
       
   544 // Destructor
       
   545 EXPORT_C CPhoneMethodLogger::~CPhoneMethodLogger()
       
   546     {
       
   547     TBuf<KMaxLogLineLength> str;
       
   548     switch( iLoggingComponent )
       
   549         {
       
   550         case EPhoneControl:
       
   551             str.Append( KPhoneUIControl );
       
   552             break;
       
   553         
       
   554         case EPhonePhoneapp:
       
   555             str.Append( KPhoneUI );
       
   556             break;
       
   557             
       
   558         case EPhoneUIView:
       
   559             str.Append( KPhoneUIView );
       
   560             break;
       
   561             
       
   562         case EPhoneUIStates:
       
   563             str.Append( KPhoneUIStates );
       
   564             break;
       
   565             
       
   566         case EPhoneUIUtils:
       
   567             str.Append( KPhoneUIUtils );
       
   568             break;
       
   569 
       
   570         case EPhoneMediatorCenter:
       
   571             str.Append( KPhoneMediatorCenter );
       
   572             break;
       
   573             
       
   574         default:
       
   575             break;
       
   576         }
       
   577     str.Append( iString );
       
   578     str.Append( KGreaterThan );
       
   579 
       
   580     CPhoneLogger * logger = static_cast<CPhoneLogger*>(
       
   581         CCoeEnv::Static( KUidPhoneUILoggerSingleton ) );
       
   582     if ( logger )
       
   583         {
       
   584         logger->LogIt( EMethodStartEnd, iLoggingComponent, str );
       
   585         }
       
   586     }
       
   587 
       
   588 //  End of File  
       
   589