uifw/inc/akntrace.h
changeset 0 2f259fa3e83a
equal deleted inserted replaced
-1:000000000000 0:2f259fa3e83a
       
     1 /*
       
     2 * Copyright (c) 2007 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:  avkon trace
       
    15 *
       
    16 */
       
    17 
       
    18 #ifndef __AKNTRACE_H_
       
    19 #define __AKNTRACE_H_
       
    20 
       
    21 #include <e32cmn.h>
       
    22 
       
    23 
       
    24 /*
       
    25  * Global switch :
       
    26  * In default, trace functions are only enabled for armv5 debug.
       
    27  * If they should be enabled on emulator, just enable the macro _AKN_TRACE_WINSCW
       
    28  */
       
    29 #if defined(__ARMCC__) && defined(_DEBUG)
       
    30 #define _AKN_TRACE_ARMCC
       
    31 #endif
       
    32 
       
    33 #if defined(__WINS__) && defined(_DEBUG)
       
    34 //#define _AKN_TRACE_WINSCW
       
    35 #endif
       
    36 
       
    37 
       
    38 #if defined(_AKN_TRACE_ARMCC) || defined(_AKN_TRACE_WINSCW)
       
    39 #define _AKNDEBUG(x)    do{x;}while(0)
       
    40 #else
       
    41 #define _AKNDEBUG(x)    do{}while(0)
       
    42 #endif
       
    43 
       
    44 
       
    45 // The macro used for tracing the normal logs in common.
       
    46 #define _AKNTRACE(args...)  _AKNDEBUG(AknTracePrint(args))  
       
    47 
       
    48 
       
    49 // AKNTRACE_FUNC_ENTER and AKNTRACE_FUNC_EXIT can be used for tracing a function entered/exited.
       
    50 #if defined(_AKN_TRACE_ARMCC)
       
    51 #define _AKNTRACE_FUNC_ENTER    _AKNTRACE("[%s][%s][%d] Enter", __MODULE__, __FUNCTION__, __LINE__)
       
    52 #define _AKNTRACE_FUNC_EXIT     _AKNTRACE("[%s][%s][%d] Exit", __MODULE__, __FUNCTION__, __LINE__)
       
    53 #elif defined(_AKN_TRACE_WINSCW)
       
    54 #define _AKNTRACE_FUNC_ENTER    _AKNTRACE("[%s][%s][%d] Enter", __FILE__, __FUNCTION__, __LINE__)
       
    55 #define _AKNTRACE_FUNC_EXIT     _AKNTRACE("[%s][%s][%d] Exit", __FILE__, __FUNCTION__, __LINE__)
       
    56 #else
       
    57 #define _AKNTRACE_FUNC_ENTER     do{}while(0)
       
    58 #define _AKNTRACE_FUNC_EXIT      do{}while(0)
       
    59 #endif
       
    60 
       
    61 // The max length of trace string.
       
    62 const TInt KAknTraceMaxLength = 0x100;
       
    63 
       
    64 /*
       
    65  * A wrapper for RDebug::Print().
       
    66  * For saving stack memory, please trace log with ANSI string as much as possible.
       
    67  */
       
    68 IMPORT_C void AknTracePrint(TRefByValue<const TDesC16> aFmt, ...);
       
    69 IMPORT_C void AknTracePrint(const char* aFmt, ...);
       
    70 
       
    71 
       
    72 #endif /* __AKNTRACE_H_ */