debugsrv/runmodedebug/securityserver/inc/rm_debug_logging.h
branchRCL_3
changeset 20 ca8a1b6995f6
equal deleted inserted replaced
19:07b41fa8d1dd 20:ca8a1b6995f6
       
     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 RM_DEBUG_LOGGING_H
       
    19 #define RM_DEBUG_LOGGING_H
       
    20 
       
    21 /* Debug messages
       
    22  * 
       
    23  * Debug messages are only generated for debug builds.
       
    24  * 
       
    25  * For kernel mode, use __KTRACE_OPT(KDEBUGGER, Kern::Printf(), 
       
    26  * for user mode use RDebug::Printf(). 
       
    27  * 
       
    28  */
       
    29 
       
    30 #ifdef _DEBUG
       
    31 
       
    32   #ifdef __KERNEL_MODE__
       
    33 
       
    34     #include <kernel/kernel.h>
       
    35     #include <nkern/nk_trace.h>
       
    36 
       
    37     #define LOG_MSG(args...)			__KTRACE_OPT(KDEBUGGER, Kern::Printf(args))
       
    38 	#define LOG_ENTRY()					__KTRACE_OPT(KDEBUGGER, Kern::Printf("+%s", __PRETTY_FUNCTION__))
       
    39 	#define LOG_EXIT()					__KTRACE_OPT(KDEBUGGER, Kern::Printf("-%s", __PRETTY_FUNCTION__))
       
    40 	#define LOG_ARGS(fmt, args...)		__KTRACE_OPT(KDEBUGGER, Kern::Printf("+%s " fmt, __PRETTY_FUNCTION__, args))
       
    41 	#define LOG_RETURN(x)				__KTRACE_OPT(KDEBUGGER, Kern::Printf("Returning %d from [%s]", x, __PRETTY_FUNCTION__)
       
    42 
       
    43 	// These kept for compatability
       
    44     #define LOG_MSG2( a, b )			__KTRACE_OPT(KDEBUGGER, Kern::Printf( a, b ))
       
    45     #define LOG_MSG3( a, b, c )			__KTRACE_OPT(KDEBUGGER, Kern::Printf( a, b, c ))
       
    46     #define LOG_MSG4( a, b, c, d )		__KTRACE_OPT(KDEBUGGER, Kern::Printf( a, b, c, d ))
       
    47     #define LOG_MSG5( a, b, c, d, e )	__KTRACE_OPT(KDEBUGGER, Kern::Printf( a, b, c, d, e ))
       
    48   #else
       
    49 
       
    50     #include <e32debug.h>
       
    51 
       
    52     #define LOG_MSG(args...)			RDebug::Printf(args)
       
    53 	#define LOG_DES(args...)			RDebug::Print(args) // For wide descriptors
       
    54 	#define LOG_ENTRY()					RDebug::Printf("+%s", __PRETTY_FUNCTION__)
       
    55 	#define LOG_EXIT()					RDebug::Printf("-%s", __PRETTY_FUNCTION__)
       
    56 	#define LOG_ARGS(fmt, args...)		RDebug::Printf("+%s " fmt, __PRETTY_FUNCTION__, args)
       
    57 	#define LOG_RETURN(x)				RDebug::Printf("Returning %d from [%s]", x, __PRETTY_FUNCTION__)
       
    58 
       
    59     #define LOG_MSG2( a, b )			RDebug::Printf( a, b )
       
    60     #define LOG_MSG3( a, b, c )			RDebug::Printf( a, b, c )
       
    61     #define LOG_MSG4( a, b, c, d )		RDebug::Printf( a, b, c, d )
       
    62     #define LOG_MSG5( a, b, c, d, e )	RDebug::Printf( a, b, c, d, e )
       
    63 
       
    64   #endif
       
    65 
       
    66 #else
       
    67 
       
    68 	#define LOG_MSG(args...)
       
    69 	#define LOG_DES(args...)
       
    70 	#define LOG_ENTRY()
       
    71 	#define LOG_EXIT()
       
    72 	#define LOG_ARGS(fmt, args...)
       
    73 	#define LOG_RETURN(x)
       
    74 
       
    75 	#define LOG_MSG2( a, b )
       
    76 	#define LOG_MSG3( a, b, c )
       
    77 	#define LOG_MSG4( a, b, c, d )
       
    78 	#define LOG_MSG5( a, b, c, d, e )
       
    79 
       
    80 #endif
       
    81 
       
    82 #endif //RM_DEBUG_LOGGING_H
       
    83