email/imum/logging/ImumLogTrapHandler.h
branchRCL_3
changeset 27 7fdbb852d323
parent 0 72b543305e3a
equal deleted inserted replaced
26:ebe688cedc25 27:7fdbb852d323
       
     1 /*
       
     2 * Copyright (c) 2006 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:  ImumLogTrapHandler.h
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 #ifndef IMUMLOGTRAPHANDLER_H
       
    20 #define IMUMLOGTRAPHANDLER_H
       
    21 
       
    22 #ifdef _DEBUG
       
    23 
       
    24 #include <e32std.h>
       
    25 #include "ImumLogConfig.h"
       
    26 #include "ImumLogContext.h"
       
    27 
       
    28 #define _IMUM_TRAP_HARNESS_ENTRY      L"_D%d[%x:%x:%x]TraceFramework: Entering trap harness"
       
    29 #define _IMUM_TRAP_HARNESS_EXIT       L"_D%d[%x:%x:%x]TraceFramework: Exiting trap harness"
       
    30 #define _IMUM_TRAP_HARNESS_LEAVE      L"_D%d[%x:%x:%x]TraceFramework: ---------- LEAVE OCCURRED !!! ---------- "
       
    31 static const TUint IMUMERR   = 2;  /**< Used to create an error message */
       
    32 
       
    33 class _TImumTrapHandler: public TTrapHandler
       
    34     {
       
    35     public:
       
    36 
       
    37         _TImumTrapHandler(_TImumContext& _context) : _dc( _context )
       
    38             {
       
    39             RThread me;
       
    40             iThdId = (TInt)me.Id();
       
    41             }
       
    42     	void Trap()
       
    43     	    {
       
    44     	    _IMUMPRINTER(_IT(_IMUM_TRAP_HARNESS_ENTRY), 0, IMUMERR, iThdId, this);
       
    45     	    oldHandler->Trap();
       
    46     	    }
       
    47     	void UnTrap()
       
    48     	    {
       
    49     	    _IMUMPRINTER(_IT(_IMUM_TRAP_HARNESS_EXIT), 0, IMUMERR, iThdId, this);
       
    50     	    oldHandler->UnTrap();
       
    51     	    }
       
    52     	void Leave(TInt aValue)
       
    53     	    {
       
    54     	    _IMUMPRINTER(_IT(_IMUM_TRAP_HARNESS_LEAVE), 0, IMUMERR, iThdId, this);
       
    55     	    oldHandler->Leave(aValue);
       
    56     	    }
       
    57     	TTrapHandler* oldHandler;
       
    58     private:
       
    59         _TImumContext& _dc;
       
    60         TInt iThdId;
       
    61     };
       
    62 
       
    63 #endif // _DEBUG
       
    64 
       
    65 #endif // IMUMLOGTRAPHANDLER_H