kerneltest/f32test/shostmassstorage/testclient/usbtestmsclient/inc/msdebug.h
changeset 300 1d28c8722707
parent 293 0659d0e1a03c
child 301 172f33f13d7d
equal deleted inserted replaced
293:0659d0e1a03c 300:1d28c8722707
     1 // Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
       
     2 // All rights reserved.
       
     3 // This component and the accompanying materials are made available
       
     4 // under the terms of the License "Eclipse Public License v1.0"
       
     5 // which accompanies this distribution, and is available
       
     6 // at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
     7 //
       
     8 // Initial Contributors:
       
     9 // Nokia Corporation - initial contribution.
       
    10 //
       
    11 // Contributors:
       
    12 //
       
    13 // Description:
       
    14 // msdebug.cpp
       
    15 // 
       
    16 //
       
    17 
       
    18 
       
    19 
       
    20 /**
       
    21  @file
       
    22  @internalTechnology
       
    23 */
       
    24 
       
    25 #ifndef MSDEBUG_H
       
    26 #define MSDEBUG_H
       
    27 
       
    28 //#define _MSFN_DEBUG_PRINT_
       
    29 
       
    30 #if defined(_MSFN_DEBUG_PRINT_) && (defined(_DEBUG) || defined(_DEBUG_RELEASE))
       
    31 #define MSFN_TRACE_ENABLED
       
    32 #endif
       
    33 
       
    34 #ifdef MSFN_TRACE_ENABLED
       
    35 #include <e32debug.h>
       
    36 
       
    37 
       
    38 /**
       
    39 Logging function to be used with static functions. Prints the function string on
       
    40 function entry and exit.
       
    41 */
       
    42 class TMsLogStaticFn
       
    43     {
       
    44 public:
       
    45     static const TInt KLogBufferSize = 0xFF;
       
    46 
       
    47     TMsLogStaticFn(const TDesC8& aFunctionName);
       
    48 
       
    49 	~TMsLogStaticFn();
       
    50 
       
    51 protected:
       
    52     TBuf8<KLogBufferSize> buf;
       
    53 	TPtrC8 iFunctionName;
       
    54     };
       
    55 
       
    56 
       
    57 /**
       
    58 Logging function which prints the function string on function entry and exit.
       
    59 */
       
    60 class TMsLogFn
       
    61     {
       
    62 public:
       
    63     static const TInt KLogBufferSize = 0xFF;
       
    64 	TMsLogFn(const TDesC8& aFunctionName, void* aThisPointer);
       
    65 
       
    66 	~TMsLogFn();
       
    67 
       
    68 private:
       
    69     TBuf8<KLogBufferSize> buf;
       
    70 	TPtrC8 iFunctionName;
       
    71 	void* iThisPointer;
       
    72     };
       
    73 
       
    74 
       
    75 
       
    76 #define __MSFNLOG TMsLogFn funcLog(TPtrC8((TUint8*)__PRETTY_FUNCTION__), this);
       
    77 #define __MSFNSLOG TMsLogStaticFn funcLog(TPtrC8((TUint8*)__PRETTY_FUNCTION__));
       
    78 #else
       
    79 #define __MSFNSLOG
       
    80 #define __MSFNLOG
       
    81 #endif
       
    82 
       
    83 #endif // MSDEBUG_H