deviceencryption/common/DevEncLog.h
branchRCL_3
changeset 20 491b3ed49290
parent 19 95243422089a
child 21 65326cf895ed
equal deleted inserted replaced
19:95243422089a 20:491b3ed49290
     1 /*
       
     2 * Copyright (c) 2005 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:  Debug logging functionality.
       
    15 *
       
    16 */
       
    17 
       
    18 #ifndef __DEVENC_LOG_H__
       
    19 #define __DEVENC_LOG_H__
       
    20 
       
    21 #include "DevEncConfig.hrh"
       
    22 
       
    23 #if defined( _DEBUG ) && defined ( DEVENC_LOG )
       
    24 
       
    25 #include <e32base.h>
       
    26 #include <e32cmn.h>
       
    27 #include <e32debug.h>
       
    28 
       
    29 class CFileLog : public CBase
       
    30 	{
       
    31     public:
       
    32     	static void Printf( TRefByValue<const TDesC> aFmt, ... );
       
    33 	};
       
    34 
       
    35 // Debug trace to stdout
       
    36 #define DLOG( aText ) \
       
    37     { \
       
    38     _LIT( KText, aText ); \
       
    39     RDebug::Print( KText ); \
       
    40     }
       
    41 
       
    42 // Debug trace to stdout
       
    43 #define DLOG2( aText, aParam ) \
       
    44     { \
       
    45     _LIT( KText, aText ); \
       
    46     RDebug::Print( KText, aParam ); \
       
    47     }
       
    48 
       
    49 // Debug trace to stdout
       
    50 #define DLOG3( aText, aParam1, aParam2 ) \
       
    51     { \
       
    52     _LIT( KText, aText ); \
       
    53     RDebug::Print( KText, aParam1, aParam2 ); \
       
    54     }
       
    55 
       
    56 // Debug trace to file
       
    57 #define FLOG( aText ) \
       
    58     { \
       
    59     _LIT( KLogText, aText ); \
       
    60     CFileLog::Printf( KLogText ); \
       
    61     }
       
    62 
       
    63 // Debug trace to file
       
    64 #define FLOG2( aText, b ) \
       
    65     { \
       
    66     _LIT( KLogText, aText ); \
       
    67     CFileLog::Printf( KLogText, b ); \
       
    68     }
       
    69 
       
    70 // Debug trace to file
       
    71 #define FLOG3( aText, b, c ) \
       
    72     { \
       
    73     _LIT( KLogText, aText ); \
       
    74     CFileLog::Printf( KLogText, b, c ); \
       
    75     }
       
    76 
       
    77 // Debug trace to stdout and file
       
    78 #define DFLOG( aText ) \
       
    79     { \
       
    80     DLOG( aText ); \
       
    81     FLOG( aText ); \
       
    82     }
       
    83 
       
    84 // Debug trace to stdout and file
       
    85 #define DFLOG2( aText, aParam ) \
       
    86     { \
       
    87     DLOG2( aText, aParam ); \
       
    88     FLOG2( aText, aParam ); \
       
    89     }
       
    90 
       
    91 // Debug trace to stdout and file
       
    92 #define DFLOG3( aText, aParam1, aParam2 ) \
       
    93     { \
       
    94     DLOG3( aText, aParam1, aParam2 ); \
       
    95     FLOG3( aText, aParam1, aParam2 ); \
       
    96     }
       
    97 
       
    98 // Debug trace a string literal to file
       
    99 #define FLOGBUF( aText ) \
       
   100     { \
       
   101     CFileLog::Printf( aText ); \
       
   102     }
       
   103 
       
   104 // Debug trace a string literal
       
   105 #define DLOGBUF( aText ) \
       
   106     { \
       
   107     RDebug::Print( aText ); \
       
   108     }
       
   109 
       
   110 // Debug trace a string literal to file and stdout
       
   111 #define DFLOGBUF( aText ) \
       
   112     { \
       
   113     DLOGBUF( aText ); \
       
   114     FLOGBUF( aText ); \
       
   115     }
       
   116     
       
   117 #else   // _DEBUG not defined, no logging code will be included at all
       
   118 
       
   119 #define DLOG( a )
       
   120 #define DLOG2( a, b )
       
   121 #define DLOG3( a, b, c )
       
   122 #define FLOG( a )
       
   123 #define FLOG2( a, b )
       
   124 #define FLOG3( a, b, c )
       
   125 #define DFLOG( a )
       
   126 #define DFLOG2( a, b )
       
   127 #define DFLOG3( a, b, c )
       
   128 #define FLOGBUF( a )
       
   129 #define DFLOGBUF( a )
       
   130     
       
   131 #endif // _DEBUG
       
   132 
       
   133 #endif // __DEVENC_LOG_H__
       
   134 
       
   135 // End of File
       
   136