mediator/inc/Server/MediatorDebug.inl
changeset 0 4e1aa6a622a0
equal deleted inserted replaced
-1:000000000000 0:4e1aa6a622a0
       
     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:  Mediator logging services inline implementation.
       
    15 *                This file contains also empty implementations for release build.
       
    16 *
       
    17 */
       
    18 
       
    19 
       
    20 #ifdef _DEBUG
       
    21 
       
    22 // -----------------------------------------------------------------------------
       
    23 // RMediatorDebug::Initialize
       
    24 // ?implementation_description
       
    25 // (other items were commented in a header).
       
    26 // -----------------------------------------------------------------------------
       
    27 //
       
    28 inline void RMediatorDebug::Initialize(CMediatorServer* aMediator)
       
    29     {
       
    30     if (iInstance == NULL)
       
    31         {
       
    32         TRAPD(err, iInstance = NewL(aMediator));
       
    33         
       
    34         if (err != KErrNone)
       
    35             {
       
    36             HandleInitError( err );
       
    37             }
       
    38         }
       
    39     }
       
    40 
       
    41 // -----------------------------------------------------------------------------
       
    42 // RMediatorDebug::Uninitialize
       
    43 // ?implementation_description
       
    44 // (other items were commented in a header).
       
    45 // -----------------------------------------------------------------------------
       
    46 //    
       
    47 inline void RMediatorDebug::Uninitialize()
       
    48     {
       
    49     delete iInstance;
       
    50     iInstance = NULL;
       
    51     }
       
    52 
       
    53 // -----------------------------------------------------------------------------
       
    54 // RMediatorDebug::Log
       
    55 // Prints log about operation
       
    56 // (other items were commented in a header).
       
    57 // -----------------------------------------------------------------------------
       
    58 //
       
    59 inline void RMediatorDebug::Log(const RMessage2& aMessage, CMediatorServerSession& aSession)
       
    60     {
       
    61     if ( iInstance == NULL )
       
    62         return;
       
    63 
       
    64     TRAPD(err, iInstance->PrintOperationL(aMessage, aSession));
       
    65     iInstance->HandleInternalError(err);
       
    66     }
       
    67 
       
    68 // -----------------------------------------------------------------------------
       
    69 // RMediatorDebug::LogStatus
       
    70 // Prints log for current status of mediator
       
    71 // (other items were commented in a header).
       
    72 // -----------------------------------------------------------------------------
       
    73 //
       
    74 inline void RMediatorDebug::LogStatus()
       
    75     {
       
    76     if ( iInstance == NULL )
       
    77         return;
       
    78     
       
    79     TRAPD(err, iInstance->PrintServerStatusL());
       
    80     iInstance->HandleInternalError(err);
       
    81     }
       
    82 
       
    83 // -----------------------------------------------------------------------------
       
    84 // RMediatorDebug::LogError
       
    85 // Prints log for a operation error
       
    86 // (other items were commented in a header).
       
    87 // -----------------------------------------------------------------------------
       
    88 //
       
    89 inline void RMediatorDebug::LogError(const RMessage2& aMessage, TInt aError)
       
    90     {
       
    91     if ( iInstance == NULL )
       
    92         return;
       
    93     
       
    94     TRAPD(err, iInstance->PrintErrorL(aMessage, aError));
       
    95     iInstance->HandleInternalError(err);
       
    96     }
       
    97 
       
    98 // -----------------------------------------------------------------------------
       
    99 // RMediatorDebug::LogPlugin
       
   100 // Prints information about plugin implementation
       
   101 // (other items were commented in a header).
       
   102 // -----------------------------------------------------------------------------
       
   103 //
       
   104 inline void RMediatorDebug::LogPlugin(const CImplementationInformation* aImpl)
       
   105     {
       
   106     if ( iInstance == NULL )
       
   107         return;
       
   108     
       
   109     TRAPD(err, iInstance->PrintPluginL(aImpl));
       
   110     iInstance->HandleInternalError(err);
       
   111     }
       
   112 
       
   113 // -----------------------------------------------------------------------------
       
   114 // RMediatorDebug::LogData
       
   115 // Prints event information
       
   116 // (other items were commented in a header).
       
   117 // -----------------------------------------------------------------------------
       
   118 //
       
   119 inline void RMediatorDebug::LogData(const RMessage2& aMessage, CMediatorServerSession& aSession, const TEvent& aEvent)
       
   120     {
       
   121      if ( iInstance == NULL )
       
   122         return;
       
   123     
       
   124     TRAPD(err, iInstance->PrintEventL(aMessage, aSession, aEvent, 0));
       
   125     iInstance->HandleInternalError(err);
       
   126     }
       
   127 
       
   128 // -----------------------------------------------------------------------------
       
   129 // RMediatorDebug::LogData
       
   130 // Prints event list information
       
   131 // (other items were commented in a header).
       
   132 // -----------------------------------------------------------------------------
       
   133 //    
       
   134 inline void RMediatorDebug::LogData(const RMessage2& aMessage, CMediatorServerSession& aSession, const REventList& aEventList)
       
   135     {
       
   136      if ( iInstance == NULL )
       
   137         return;
       
   138     
       
   139     TRAPD(err, iInstance->PrintEventListL(aMessage, aSession, aEventList));
       
   140     iInstance->HandleInternalError(err);
       
   141     }
       
   142 
       
   143 // -----------------------------------------------------------------------------
       
   144 // RMediatorDebug::LogData
       
   145 // Prints command information
       
   146 // (other items were commented in a header).
       
   147 // -----------------------------------------------------------------------------
       
   148 //
       
   149 inline void RMediatorDebug::LogData(const RMessage2& aMessage, CMediatorServerSession& aSession, const TCommand& aCommand)
       
   150     {
       
   151      if ( iInstance == NULL )
       
   152         return;
       
   153     
       
   154     TRAPD(err, iInstance->PrintCommandL(aMessage, aSession, aCommand, 0));
       
   155     iInstance->HandleInternalError(err);
       
   156     }
       
   157 
       
   158 // -----------------------------------------------------------------------------
       
   159 // RMediatorDebug::LogData
       
   160 // Prints command list information
       
   161 // (other items were commented in a header).
       
   162 // -----------------------------------------------------------------------------
       
   163 //
       
   164 inline void RMediatorDebug::LogData(const RMessage2& aMessage, CMediatorServerSession& aSession, const RCommandList& aCommandList)
       
   165     {
       
   166     if ( iInstance == NULL )
       
   167         return;
       
   168     
       
   169     TRAPD(err, iInstance->PrintCommandListL(aMessage, aSession, aCommandList));
       
   170     iInstance->HandleInternalError(err);
       
   171     }
       
   172 
       
   173 // -----------------------------------------------------------------------------
       
   174 // RMediatorDebug::LogData
       
   175 // Prints UID list
       
   176 // (other items were commented in a header).
       
   177 // -----------------------------------------------------------------------------
       
   178 //    
       
   179 inline void RMediatorDebug::LogData(const RMessage2& aMessage, CMediatorServerSession& aSession, const RCategoryList& aCategoryList)
       
   180     {
       
   181     if ( iInstance == NULL )
       
   182         return;
       
   183     
       
   184     TRAPD(err, iInstance->PrintCategoryListL(aMessage, aSession, aCategoryList));
       
   185     iInstance->HandleInternalError(err);
       
   186     }
       
   187 
       
   188 // -----------------------------------------------------------------------------
       
   189 // RMediatorDebug::LogData
       
   190 // Prints raw data
       
   191 // (other items were commented in a header).
       
   192 // -----------------------------------------------------------------------------
       
   193 //
       
   194 inline void RMediatorDebug::LogData(const RMessage2& aMessage, CMediatorServerSession& aSession, const TDesC8& aData)
       
   195     {
       
   196     if ( iInstance == NULL )
       
   197         return;
       
   198     
       
   199     TRAPD(err, iInstance->PrintRawL(aMessage, aSession, aData));
       
   200     iInstance->HandleInternalError(err);
       
   201     }
       
   202 
       
   203 #else // _DEBUG
       
   204 
       
   205 inline RMediatorDebug::~RMediatorDebug() {}
       
   206 
       
   207 inline void RMediatorDebug::Initialize(CMediatorServer* /*aMediator*/) {}
       
   208 
       
   209 inline void RMediatorDebug::Uninitialize() {}
       
   210 
       
   211 inline void RMediatorDebug::Log(const RMessage2& /*aMessage*/, CMediatorServerSession& /*aSession*/) {}
       
   212     
       
   213 inline void RMediatorDebug::LogData(const RMessage2& /*aMessage*/, CMediatorServerSession& /*aSession*/, const MediatorService::REventList& /*aEventList*/) {}
       
   214 
       
   215 inline void RMediatorDebug::LogData(const RMessage2& /*aMessage*/, CMediatorServerSession& /*aSession*/, const MediatorService::TEvent& /*aEvent*/) {}
       
   216 
       
   217 inline void RMediatorDebug::LogData(const RMessage2& /*aMessage*/, CMediatorServerSession& /*aSession*/, const MediatorService::RCommandList& /*aCommandList*/) {}
       
   218 
       
   219 inline void RMediatorDebug::LogData(const RMessage2& /*aMessage*/, CMediatorServerSession& /*aSession*/, const MediatorService::TCommand& /*aCommand*/) {}
       
   220 
       
   221 inline void RMediatorDebug::LogData(const RMessage2& /*aMessage*/, CMediatorServerSession& /*aSession*/, const MediatorService::RCategoryList& /*aCategoryList*/) {}
       
   222 
       
   223 inline void RMediatorDebug::LogData(const RMessage2& /*aMessage*/, CMediatorServerSession& /*aSession*/, const TDesC8& /*aData*/) {}
       
   224 
       
   225 inline void RMediatorDebug::LogStatus() {}
       
   226 
       
   227 inline void RMediatorDebug::LogError(const RMessage2& /*aMessage*/, TInt /*aError*/) {}
       
   228 
       
   229 inline void RMediatorDebug::LogPlugin(const CImplementationInformation* /*aImpl*/) {}
       
   230 
       
   231 #endif // _DEBUG