sysstatemgmt/systemstatemgr/localinc/ssmdebug.h
changeset 0 4e1aa6a622a0
equal deleted inserted replaced
-1:000000000000 0:4e1aa6a622a0
       
     1 // Copyright (c) 2007-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 "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 // Encapsulates the debug logging mechanism.
       
    15 // 
       
    16 //
       
    17 
       
    18 /**
       
    19  @file
       
    20  @internalComponent
       
    21  @released
       
    22 */
       
    23 
       
    24 #ifndef __SSMDEBUG_H__
       
    25 #define __SSMDEBUG_H__
       
    26 
       
    27 #ifdef _DEBUG
       
    28 #include <e32debug.h>
       
    29 #ifdef SYMBIAN_SSM_FLEXIBLE_MERGE
       
    30 #ifdef SYMBIAN_TRACE_ENABLE
       
    31 #include <uloggerclient.h>
       
    32 #include <e32btrace.h>
       
    33 #endif //SYMBIAN_TRACE_ENABLE
       
    34 #endif //SYMBIAN_SSM_FLEXIBLE_MERGE
       
    35 
       
    36 #define SSMLOGLEAVE(_p1) {TInt _val=_p1; RDebug::Printf("%s %d: Unconditional leave %s evaluates to %d ", __FILE__,__LINE__, #_p1, _val); User::Leave(_val); }
       
    37 #define SSMLOGLEAVEIFERROR(_p1) {TInt _err=_p1; if(KErrNone!=_err) RDebug::Printf("%s %d: Leaving because %s evaluates to (%d)", __FILE__,__LINE__, #_p1, _err); User::LeaveIfError(_err); }
       
    38 #define SSMLOGLEAVEIFNOTERROR(_p1) {TInt _err=_p1; if(KErrNone==_err) { RDebug::Printf("%s %d: Leaving (with no error) because %s evaluates to (%d)", __FILE__,__LINE__, #_p1, _err); User::Leave(_err); } }
       
    39 #define SSMLOGLEAVEIFNULL(_p1) {TAny* _p=_p1; if(NULL==_p) RDebug::Printf("%s %d: Leaving because %s evaluates to NULL", __FILE__,__LINE__, #_p1); User::LeaveIfNull(_p); }
       
    40 #define SSMLOGLEAVEIFFALSE(_p1, _p2) {TInt _val=_p1; if(!_val) RDebug::Printf("%s %d: Leaving with %s because %s evaluates to FALSE", __FILE__,__LINE__, #_p2, #_p1); if(!_val) User::Leave(_p2); }
       
    41 #define SSMLOGLEAVEIFTRUE(_p1, _p2) {TInt _val=_p1; if(_val) RDebug::Printf("%s %d: Leaving with %s because %s evaluates to TRUE", __FILE__,__LINE__, #_p2, #_p1); if(_val) User::Leave(_p2); }
       
    42 
       
    43 #define DEBUGPRINT1(_p1) RDebug::Print(_p1)
       
    44 #define DEBUGPRINT2(_p1,_p2) RDebug::Print(_p1,_p2)
       
    45 #define DEBUGPRINT3(_p1,_p2,_p3) RDebug::Print(_p1,_p2,_p3)
       
    46 #define DEBUGPRINT4(_p1,_p2,_p3,_p4) RDebug::Print(_p1,_p2,_p3,_p4)
       
    47 #define DEBUGPRINT5(_p1,_p2,_p3,_p4,_p5) RDebug::Print(_p1,_p2,_p3,_p4,_p5)
       
    48 #define DEBUGPRINT6(_p1,_p2,_p3,_p4,_p5,_p6) RDebug::Print(_p1,_p2,_p3,_p4,_p5,_p6)
       
    49 #define DEBUGPRINT7(_p1,_p2,_p3,_p4,_p5,_p6,_p7) RDebug::Print(_p1,_p2,_p3,_p4,_p5,_p6,_p7)
       
    50 
       
    51 #define DEBUGPRINT1A(_p1) RDebug::Printf("%s %d: %s", __FILE__, __LINE__, _p1)
       
    52 #define DEBUGPRINT2A(_p1,_p2) RDebug::Printf("%s %d: "_p1, __FILE__, __LINE__, _p2)
       
    53 #define DEBUGPRINT3A(_p1,_p2,_p3) RDebug::Printf("%s %d: "_p1, __FILE__, __LINE__, _p2, _p3)
       
    54 #define DEBUGPRINT4A(_p1,_p2,_p3,_p4) RDebug::Printf("%s %d: "_p1, __FILE__, __LINE__, _p2, _p3, _p4)
       
    55 #define DEBUGPRINT5A(_p1,_p2,_p3,_p4,_p5) RDebug::Printf("%s %d: "_p1, __FILE__, __LINE__, _p2, _p3, _p4,_p5)
       
    56 #define DEBUGPRINT6A(_p1,_p2,_p3,_p4,_p5,_p6) RDebug::Printf("%s %d: "_p1, __FILE__, __LINE__, _p2, _p3, _p4,_p5,_p6)
       
    57 #define DEBUGPRINT7A(_p1,_p2,_p3,_p4,_p5,_p6,_p7) RDebug::Printf("%s %d: "_p1, __FILE__, __LINE__, _p2, _p3, _p4,_p5,_p6,_p7)
       
    58 
       
    59 #ifdef SSM_VERBOSE_DEBUG
       
    60 #define DEBUGVERBOSE1A(_p1) RDebug::Printf("%s %d: %s", __FILE__, __LINE__, _p1)
       
    61 #define DEBUGVERBOSE2A(_p1,_p2) RDebug::Printf("%s %d: "_p1, __FILE__, __LINE__, _p2)
       
    62 #define DEBUGVERBOSE3A(_p1,_p2,_p3) RDebug::Printf("%s %d: "_p1, __FILE__, __LINE__, _p2, _p3)
       
    63 #define DEBUGVERBOSE4A(_p1,_p2,_p3,_p4) RDebug::Printf("%s %d: "_p1, __FILE__, __LINE__, _p2, _p3, _p4)
       
    64 #define DEBUGVERBOSE5A(_p1,_p2,_p3,_p4,_p5) RDebug::Printf("%s %d: "_p1, __FILE__, __LINE__, _p2, _p3, _p4,_p5)
       
    65 #define DEBUGVERBOSE6A(_p1,_p2,_p3,_p4,_p5,_p6) RDebug::Printf("%s %d: "_p1, __FILE__, __LINE__, _p2, _p3, _p4,_p5,_p6)
       
    66 #define DEBUGVERBOSE7A(_p1,_p2,_p3,_p4,_p5,_p6,_p7) RDebug::Printf("%s %d: "_p1, __FILE__, __LINE__, _p2, _p3, _p4,_p5,_p6,_p7)
       
    67 #else
       
    68 #define DEBUGVERBOSE1A(_p1)
       
    69 #define DEBUGVERBOSE2A(_p1,_p2)
       
    70 #define DEBUGVERBOSE3A(_p1,_p2,_p3)
       
    71 #define DEBUGVERBOSE4A(_p1,_p2,_p3,_p4)
       
    72 #define DEBUGVERBOSE5A(_p1,_p2,_p3,_p4,_p5)
       
    73 #define DEBUGVERBOSE6A(_p1,_p2,_p3,_p4,_p5,_p6)
       
    74 #define DEBUGVERBOSE7A(_p1,_p2,_p3,_p4,_p5,_p6,_p7)
       
    75 #endif	//SSM_VERBOSE_DEBUG
       
    76 
       
    77 #else
       
    78 
       
    79 #define SSMLOGLEAVE(_p1) 			User::Leave(_p1)
       
    80 #define SSMLOGLEAVEIFERROR(_p1) 		User::LeaveIfError(_p1)
       
    81 #define SSMLOGLEAVEIFNOTERROR(_p1) 	{ TInt _err=_p1; if(KErrNone==_err) User::Leave(_err); }
       
    82 #define SSMLOGLEAVEIFNULL(_p1) 		User::LeaveIfNull(_p1)
       
    83 #define SSMLOGLEAVEIFFALSE(_p1, _p2) {TInt _val=_p1; if(!_val) User::Leave(_p2); }
       
    84 #define SSMLOGLEAVEIFTRUE(_p1, _p2) 	{TInt _val=_p1; if(_val) if(_val) User::Leave(_p2); }
       
    85 
       
    86 #define DEBUGPRINT1(_p1)
       
    87 #define DEBUGPRINT2(_p1,_p2)
       
    88 #define DEBUGPRINT3(_p1,_p2,_p3)
       
    89 #define DEBUGPRINT4(_p1,_p2,_p3,_p4)
       
    90 #define DEBUGPRINT5(_p1,_p2,_p3,_p4,_p5)
       
    91 #define DEBUGPRINT6(_p1,_p2,_p3,_p4,_p5,_p6)
       
    92 #define DEBUGPRINT7(_p1,_p2,_p3,_p4,_p5,_p6,_p7)
       
    93 
       
    94 #define DEBUGPRINT1A(_p1)
       
    95 #define DEBUGPRINT2A(_p1,_p2)
       
    96 #define DEBUGPRINT3A(_p1,_p2,_p3)
       
    97 #define DEBUGPRINT4A(_p1,_p2,_p3,_p4)
       
    98 #define DEBUGPRINT5A(_p1,_p2,_p3,_p4,_p5)
       
    99 #define DEBUGPRINT6A(_p1,_p2,_p3,_p4,_p5,_p6)
       
   100 #define DEBUGPRINT7A(_p1,_p2,_p3,_p4,_p5,_p6,_p7)
       
   101 
       
   102 #define DEBUGVERBOSE1A(_p1)
       
   103 #define DEBUGVERBOSE2A(_p1,_p2)
       
   104 #define DEBUGVERBOSE3A(_p1,_p2,_p3)
       
   105 #define DEBUGVERBOSE4A(_p1,_p2,_p3,_p4)
       
   106 #define DEBUGVERBOSE5A(_p1,_p2,_p3,_p4,_p5)
       
   107 #define DEBUGVERBOSE6A(_p1,_p2,_p3,_p4,_p5,_p6)
       
   108 #define DEBUGVERBOSE7A(_p1,_p2,_p3,_p4,_p5,_p6,_p7)
       
   109 
       
   110 #endif //_DEBUG
       
   111 
       
   112 #endif //__SSMDEBUG_H__
       
   113