userlibandfileserver/fileserver/shostmassstorage/server/shared/msdebug.h
changeset 297 b2826f67641f
parent 296 94f2adf59133
child 299 b5a01337d018
equal deleted inserted replaced
296:94f2adf59133 297:b2826f67641f
     1 // Copyright (c) 2008-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  @file
       
    20  @internalTechnology
       
    21 */
       
    22 
       
    23 #ifndef MSDEBUG_H
       
    24 #define MSDEBUG_H
       
    25 
       
    26 // #define _MSFN_DEBUG_PRINT_
       
    27 
       
    28 #if defined(_MSFN_DEBUG_PRINT_) && (defined(_DEBUG) || defined(_DEBUG_RELEASE))
       
    29 #define MSFN_TRACE_ENABLED
       
    30 #endif
       
    31 
       
    32 #ifdef MSFN_TRACE_ENABLED
       
    33 #include <e32debug.h>
       
    34 
       
    35 
       
    36 /**
       
    37 Logging function to be used with static functions. Prints the function string on
       
    38 function entry and exit.
       
    39 */
       
    40 class TMsLogStaticFn
       
    41     {
       
    42 public:
       
    43     static const TInt KLogBufferSize = 0xFF;
       
    44 
       
    45     TMsLogStaticFn(const TDesC8& aFunctionName);
       
    46 
       
    47 	~TMsLogStaticFn();
       
    48 
       
    49 protected:
       
    50     TBuf8<KLogBufferSize> buf;
       
    51 	TPtrC8 iFunctionName;
       
    52     };
       
    53 
       
    54 
       
    55 /**
       
    56 Logging function which prints the function string on function entry and exit.
       
    57 */
       
    58 class TMsLogFn
       
    59     {
       
    60 public:
       
    61     static const TInt KLogBufferSize = 0xFF;
       
    62 	TMsLogFn(const TDesC8& aFunctionName, void* aThisPointer);
       
    63 
       
    64 	~TMsLogFn();
       
    65 
       
    66 private:
       
    67     TBuf8<KLogBufferSize> buf;
       
    68 	TPtrC8 iFunctionName;
       
    69 	void* iThisPointer;
       
    70     };
       
    71 
       
    72 
       
    73 
       
    74 #define __MSFNLOG TMsLogFn funcLog(TPtrC8((TUint8*)__PRETTY_FUNCTION__), this);
       
    75 #define __MSFNSLOG TMsLogStaticFn funcLog(TPtrC8((TUint8*)__PRETTY_FUNCTION__));
       
    76 #else
       
    77 #define __MSFNSLOG
       
    78 #define __MSFNLOG
       
    79 #endif
       
    80 
       
    81 #endif // MSDEBUG_H
       
    82 
       
    83