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