stif/TestServer/inc/ThreadLogging.h
branchRCL_3
changeset 59 8ad140f3dd41
parent 0 a03f92240627
equal deleted inserted replaced
49:7fdc9a71d314 59:8ad140f3dd41
       
     1 /*
       
     2 * Copyright (c) 2009 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: Logging definitions.
       
    15 *
       
    16 */
       
    17 
       
    18 #ifndef LOGGINGDEFS_H
       
    19 #define LOGGINGDEFS_H
       
    20 
       
    21 //  INCLUDES
       
    22 #include <e32std.h>
       
    23 #include <e32base.h>
       
    24 
       
    25 
       
    26 // CONSTANTS
       
    27 const TUint KError           = 0x1;
       
    28 const TUint KInit            = 0x2;
       
    29 const TUint KThreadOperation = 0x4;
       
    30 const TUint KRunTestCase     = 0x8;
       
    31 const TUint KPrint           = 0x10;
       
    32 const TUint KMessage         = 0x20;
       
    33 const TUint KVerbose         = 0x40;
       
    34 const TUint KAlways          = 0xFFFFFFFF;
       
    35 const TUint KDebugLevel      = ( KMessage | KInit | KError );
       
    36 
       
    37 // MACROS
       
    38 #define __TRACING_ENABLED
       
    39 
       
    40 // Define USE_RDEBUG to use RDebug::Print for logging
       
    41 //#define USE_RDEBUG
       
    42 
       
    43 // Define USE_LOGGER to use logger for logging
       
    44 #define USE_LOGGER
       
    45 
       
    46 #ifdef __TRACING_ENABLED
       
    47 
       
    48     // TRACEI macro is used in test execution thread to allow the test use Tls for its own purposes
       
    49     // Note that handles to server (i.e to fileserver) are thread specific.
       
    50 
       
    51     // Disable conditional expression is constant -warning
       
    52     #pragma warning( disable : 4127 )
       
    53 
       
    54     // Using logger and not RDebug
       
    55     #if defined (USE_LOGGER) && !defined (USE_RDEBUG)
       
    56     #define __TRACEI(level,p) if ( (level) & KDebugLevel) { if(THREADLOGGER)THREADLOGGER->Log p; }
       
    57     #endif
       
    58 
       
    59     // Using RDebug and not Logger
       
    60     #if defined (USE_RDEBUG) && !defined (USE_LOGGER)
       
    61     #define __TRACEI(level,p) if ( (level) & KDebugLevel) { RDebug::Print p; }
       
    62     #endif
       
    63 
       
    64     // Using Logger and RDebug
       
    65     #if defined (USE_RDEBUG) && defined (USE_LOGGER)
       
    66 
       
    67     #define __TRACEI(level,p) if ( (level) & KDebugLevel) {\
       
    68         if(THREADLOGGER)THREADLOGGER->Log p;\
       
    69         RDebug::Print p;\
       
    70     }
       
    71 
       
    72     #endif
       
    73 
       
    74     // Not using RDebug and not using logger
       
    75     #if !defined(USE_RDEBUG) && !defined (USE_LOGGER)
       
    76     #define __TRACEI(level,p);
       
    77     #endif
       
    78     
       
    79     #define __RDEBUG(x) if( KVerbose & KDebugLevel){ RDebug::Print x ; }
       
    80 
       
    81 #else
       
    82     // No tracing
       
    83     #define __TRACEI(level,p);
       
    84 
       
    85     #define  __RDEBUG(x)
       
    86 #endif
       
    87 
       
    88 
       
    89 // DATA TYPES
       
    90 
       
    91 // FUNCTION PROTOTYPES
       
    92 
       
    93 // FORWARD DECLARATIONS
       
    94 
       
    95 // CLASS DECLARATION
       
    96 
       
    97 #endif // LOGGINGDEFS_H
       
    98 
       
    99 // End of File