debugsrv/runmodedebug/rmdriver/inc/debug_logging.h
changeset 42 0ff24a8f6ca2
child 56 aa2539c91954
equal deleted inserted replaced
41:838cdffd57ce 42:0ff24a8f6ca2
       
     1 // Copyright (c) 2006-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 // Logging macros for use in debug subsystem
       
    15 // 
       
    16 //
       
    17 
       
    18 #ifndef DEBUG_LOGGING_H
       
    19 #define DEBUG_LOGGING_H
       
    20 
       
    21 /**
       
    22  * Debug messages
       
    23  * 
       
    24  * Debug messages are only generated for debug builds.
       
    25  * 
       
    26  * For kernel mode, use __KTRACE_OPT(KDEBUGGER, Kern::Printf(), 
       
    27  * for user mode use RDebug::Printf(). 
       
    28  * 
       
    29  */
       
    30 
       
    31 #ifdef _DEBUG
       
    32 
       
    33   #ifdef __KERNEL_MODE__
       
    34 
       
    35 	#include <kernel/kernel.h>
       
    36 	#include <nk_trace.h>
       
    37 
       
    38 	#define LOG_MSG( a )				__KTRACE_OPT(KDEBUGGER, Kern::Printf( a ))
       
    39 	#define LOG_MSG2( a, b )			__KTRACE_OPT(KDEBUGGER, Kern::Printf( a, b ))
       
    40 	#define LOG_MSG3( a, b, c )			__KTRACE_OPT(KDEBUGGER, Kern::Printf( a, b, c ))
       
    41 	#define LOG_MSG4( a, b, c, d )		__KTRACE_OPT(KDEBUGGER, Kern::Printf( a, b, c, d ))
       
    42 	#define LOG_MSG5( a, b, c, d, e )	__KTRACE_OPT(KDEBUGGER, Kern::Printf( a, b, c, d, e ))
       
    43 
       
    44 	#ifdef __LOG_EVENTS__
       
    45 
       
    46 	#define LOG_EVENT_MSG( a )				__KTRACE_OPT(KDEBUGGER, Kern::Printf( a ))
       
    47 	#define LOG_EVENT_MSG2( a, b )			__KTRACE_OPT(KDEBUGGER, Kern::Printf( a, b ))
       
    48 	#define LOG_EVENT_MSG3( a, b, c )		__KTRACE_OPT(KDEBUGGER, Kern::Printf( a, b, c ))
       
    49 	#define LOG_EVENT_MSG4( a, b, c, d )	__KTRACE_OPT(KDEBUGGER, Kern::Printf( a, b, c, d ))
       
    50 	#define LOG_EVENT_MSG5( a, b, c, d, e )	__KTRACE_OPT(KDEBUGGER, Kern::Printf( a, b, c, d, e ))
       
    51 	
       
    52 	#else
       
    53 
       
    54 	#define LOG_EVENT_MSG( a )
       
    55 	#define LOG_EVENT_MSG2( a, b )
       
    56 	#define LOG_EVENT_MSG3( a, b, c )
       
    57 	#define LOG_EVENT_MSG4( a, b, c, d )
       
    58 	#define LOG_EVENT_MSG5( a, b, c, d, e )
       
    59 
       
    60 	#endif
       
    61 
       
    62   #else
       
    63 
       
    64     #include <e32debug.h>
       
    65 
       
    66 	#define LOG_MSG( a )				RDebug::Printf( a )
       
    67 	#define LOG_MSG2( a, b )			RDebug::Printf( a, b )
       
    68 	#define LOG_MSG3( a, b, c )			RDebug::Printf( a, b, c )
       
    69 	#define LOG_MSG4( a, b, c, d )		RDebug::Printf( a, b, c, d )
       
    70 	#define LOG_MSG5( a, b, c, d, e )	RDebug::Printf( a, b, c, d, e )
       
    71 
       
    72 	#ifdef __LOG_EVENTS__
       
    73 
       
    74 	#define LOG_EVENT_MSG( a )					RDebug::Printf( a )
       
    75 	#define LOG_EVENT_MSG2( a, b )				RDebug::Printf( a, b )
       
    76 	#define LOG_EVENT_MSG3( a, b, c )			RDebug::Printf( a, b, c )
       
    77 	#define LOG_EVENT_MSG4( a, b, c, d )		RDebug::Printf( a, b, c, d )
       
    78 	#define LOG_EVENT_MSG5( a, b, c, d, e )		RDebug::Printf( a, b, c, d, e )
       
    79 
       
    80 	#else
       
    81 
       
    82 	#define LOG_EVENT_MSG( a )
       
    83 	#define LOG_EVENT_MSG2( a, b )
       
    84 	#define LOG_EVENT_MSG3( a, b, c )
       
    85 	#define LOG_EVENT_MSG4( a, b, c, d )
       
    86 	#define LOG_EVENT_MSG5( a, b, c, d, e )
       
    87 
       
    88     #endif
       
    89 
       
    90     #endif
       
    91 #else
       
    92 
       
    93 	#define LOG_MSG( a )
       
    94 	#define LOG_MSG2( a, b )
       
    95 	#define LOG_MSG3( a, b, c )
       
    96 	#define LOG_MSG4( a, b, c, d )
       
    97 	#define LOG_MSG5( a, b, c, d, e )
       
    98 
       
    99 	#define LOG_EVENT_MSG( a )
       
   100 	#define LOG_EVENT_MSG2( a, b )
       
   101 	#define LOG_EVENT_MSG3( a, b, c )
       
   102 	#define LOG_EVENT_MSG4( a, b, c, d )
       
   103 	#define LOG_EVENT_MSG5( a, b, c, d, e )
       
   104 
       
   105 #endif
       
   106 
       
   107 #endif //DEBUG_LOGGING_H
       
   108