sensorservices/orientationssy/inc/SsyTrace.h
changeset 0 4e1aa6a622a0
equal deleted inserted replaced
-1:000000000000 0:4e1aa6a622a0
       
     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:  Defines trace macros for Orientation SSY
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 #ifndef __SSYTRACE_H__
       
    20 #define __SSYTRACE_H__
       
    21 
       
    22 
       
    23 // INCLUDES
       
    24 #include <e32debug.h>
       
    25 
       
    26 // CONSTANTS
       
    27 enum TSsyTraceGroup
       
    28     {
       
    29     ENotrace  = 0x00000000, // No traces    
       
    30     EMust     = 0x00000001, // must traces, always needed
       
    31     EError    = 0x00000002, // all error situation traces
       
    32     EFlow     = 0x00000004, // execution flow traces
       
    33     EExtended = 0x00000008  // extended traces, better to have than not    
       
    34     };
       
    35 
       
    36 #ifdef __WINS__ // orientation ssy generates a lot of trace which slows emulator down
       
    37 const TUint32 KSsyActiveTraceMask = 
       
    38       ENotrace
       
    39     + EError
       
    40     + EMust;   
       
    41 #else
       
    42 const TUint32 KSsyActiveTraceMask = 
       
    43       ENotrace
       
    44     + EFlow
       
    45     + EError
       
    46     + EMust
       
    47     + EExtended;   
       
    48 #endif
       
    49 
       
    50 #undef AUTO_ORIENTAION_TEST
       
    51 
       
    52 // MACRO DEFINITIONS
       
    53 #ifdef _DEBUG
       
    54 
       
    55     #define SSY_LOCATION( traceMask )               if ( traceMask & EError )                            \
       
    56                                                         {                                                \
       
    57                                                         RDebug::Printf( "ORIENTATIONSSY:File:%s, Function:%s, Line:%u",  __FILE__, __FUNCTION__, __LINE__ );  \
       
    58                                                         }                                                \
       
    59 
       
    60     #define SSY_TRACE_IN()                          if ( KSsyActiveTraceMask & EFlow )                   \
       
    61                                                         {                                                \
       
    62                                                         RDebug::Printf( "ORIENTATIONSSY:=> %s",  __FUNCTION__ );\
       
    63                                                         }                                                \
       
    64 
       
    65     #define SSY_TRACE_OUT()                         if ( KSsyActiveTraceMask & EFlow )                   \
       
    66                                                         {                                                \
       
    67                                                         RDebug::Printf( "ORIENTATIONSSY:<= %s",  __FUNCTION__ );\
       
    68                                                         }                                                \
       
    69 
       
    70     #define SSY_TRACE( traceMask, msg, args... )    if ( traceMask & KSsyActiveTraceMask )               \
       
    71                                                         {                                                \
       
    72                                                         SSY_LOCATION( traceMask );                       \
       
    73                                                         RDebug::Print( _L(msg), ##args );                \
       
    74                                                         }                                                \
       
    75 
       
    76     #define SSY_TRACE_TRAP(_r, _s)   TRAPD( _r, _s );              \
       
    77                                      if ( _r != KErrNone )         \
       
    78                                          {                         \
       
    79                                          SSY_TRACE( EError, "ORIENTATIONSSY:ERROR: Registering channels to the client failed with error code %d", _r );     \
       
    80                                          User::Leave( _r );        \
       
    81                                          }                         \
       
    82 
       
    83 #else
       
    84     #define SSY_TRACE_IN()
       
    85     #define SSY_TRACE_OUT()
       
    86     #define SSY_TRACE( traceMask, msg, args... )    
       
    87     #define SSY_TRACE_TRAP(_r, _s)     _s;
       
    88 #endif
       
    89 
       
    90 #define ASSERT_ALWAYS_SSY( condition )      if ( !(condition) ) RDebug::Printf( "ORIENTATIONSSY:ASSERTION:File:%s, Function:%s, Line:%u",  __FILE__, __FUNCTION__, __LINE__ ); \
       
    91                                                     __ASSERT_ALWAYS( condition, User::Panic( _L( "SSY:ASSERTION" ), __LINE__ ) );   \
       
    92 
       
    93 #define ASSERT_DEBUG_SSY( condition )       if ( !(condition) ) RDebug::Printf( "ORIENTATIONSSY:DEBUG ASSERTION:File:%s, Function:%s, Line:%u",  __FILE__, __FUNCTION__, __LINE__ ); \
       
    94                                                     __ASSERT_DEBUG( condition, User::Panic( _L( "SSY:ASSERTION" ), __LINE__ ) );    \
       
    95 
       
    96 
       
    97 #endif // __SSYTRACE_H__
       
    98 
       
    99 // End of File