pnpmobileservices/pnpms/PnpPaosFilter/src/PnpPaosLogger.h
changeset 0 3ce708148e4d
equal deleted inserted replaced
-1:000000000000 0:3ce708148e4d
       
     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:  This file defines logging interface macros
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 #ifndef __LOGGER_H__
       
    20 #define __LOGGER_H__
       
    21 
       
    22 // Set logging on only for debug builds as Paos filter is a critical component
       
    23 // when considering browser performance
       
    24 #ifdef _DEBUG
       
    25     #define LOGGING_ENABLED
       
    26 #endif
       
    27 #ifdef LOGGING_ENABLED          // This must be enabled to use logging system
       
    28 
       
    29 #define LOGGER_LOGGING          // Log to Logger
       
    30 
       
    31 
       
    32 
       
    33 #ifdef LOGGER_LOGGING
       
    34 
       
    35 //  INCLUDES
       
    36 #include <flogger.h>
       
    37 
       
    38 // LOG SETTINGS 
       
    39 _LIT( KLogFolder, "PnP" );
       
    40 _LIT( KLogFile, "PnpPaos.TXT" );
       
    41 
       
    42 #endif
       
    43 
       
    44 // CONSTANTS  
       
    45 // None.
       
    46 
       
    47 // MACROS
       
    48 /*
       
    49 -----------------------------------------------------------------------------
       
    50 
       
    51     INTERNAL MACROs. 
       
    52 
       
    53     DO NOT USE THESE DIRECTLY !!! 
       
    54     SEE EXTERNAL MACROS
       
    55 
       
    56 -----------------------------------------------------------------------------
       
    57 */
       
    58 
       
    59 #ifdef LOGGER_LOGGING
       
    60 
       
    61 
       
    62 #define INTRLOGTEXT( AAA )                                                                                        \
       
    63     {                                                                                                            \
       
    64     RFileLogger::Write( KLogFolder(), KLogFile(), EFileLoggingModeAppend, AAA );            \
       
    65     }
       
    66 #define INTRLOGSTRING( AAA )                                                                                    \
       
    67     {                                                                                                            \
       
    68     _LIT( tempLogDes, AAA );                                                                                    \
       
    69     RFileLogger::Write( KLogFolder(), KLogFile(), EFileLoggingModeAppend, tempLogDes() );    \
       
    70     }
       
    71 #define INTRLOGSTRING2( AAA, BBB )                                                                                \
       
    72     {                                                                                                            \
       
    73     _LIT( tempLogDes, AAA );                                                                                    \
       
    74     RFileLogger::WriteFormat( KLogFolder(), KLogFile(), EFileLoggingModeAppend, TRefByValue<const TDesC>( tempLogDes()), BBB ); \
       
    75     }
       
    76 #define INTRLOGSTRING3( AAA, BBB, CCC )                                                                            \
       
    77     {                                                                                                            \
       
    78     _LIT( tempLogDes, AAA );                                                                                    \
       
    79     RFileLogger::WriteFormat( KLogFolder(), KLogFile(), EFileLoggingModeAppend, TRefByValue<const TDesC>( tempLogDes()), BBB, CCC ); \
       
    80     }
       
    81 
       
    82 #define INTRLOGRSTRING( AAA, BBB ) \
       
    83     { \
       
    84     TPtrC8 string8 = BBB.DesC(); \
       
    85     HBufC* buf = HBufC::NewLC( string8.Length() ); \
       
    86     buf->Des().Copy( string8 ); \
       
    87     LOGSTRING2( AAA, buf ); \
       
    88     CleanupStack::PopAndDestroy( buf ); \
       
    89     }
       
    90 
       
    91 #else
       
    92 #define INTRLOGTEXT( AAA )
       
    93 #define INTRLOGSTRING( AAA )
       
    94 #define INTRLOGSTRING2( AAA, BBB )
       
    95 #define INTRLOGSTRING3( AAA, BBB, CCC )
       
    96 #define INTRLOGRSTRING( AAA, BBB )
       
    97 #endif
       
    98 
       
    99 /*
       
   100 -----------------------------------------------------------------------------
       
   101 
       
   102     EXTERNAL MACROs
       
   103 
       
   104     USE THESE MACROS IN YOUR CODE !
       
   105 
       
   106 -----------------------------------------------------------------------------
       
   107 */
       
   108 
       
   109 
       
   110 #define LOGTEXT( AAA )                { \
       
   111                                     INTRLOGTEXT( AAA ); \
       
   112                                     }   // Example: LOGTEXT( own_desc );
       
   113 
       
   114 #define LOGSTRING( AAA )            { \
       
   115                                     INTRLOGSTRING( AAA ); \
       
   116                                     }   // Example: LOGSTRING( "Test" );
       
   117 
       
   118 #define LOGSTRING2( AAA, BBB )        { \
       
   119                                     INTRLOGSTRING2( AAA, BBB ); \
       
   120                                     }  // Example: LOGSTRING( "Test %i", aValue );
       
   121 
       
   122 #define LOGSTRING3( AAA, BBB, CCC )    { \
       
   123                                     INTRLOGSTRING3( AAA, BBB, CCC ); \
       
   124                                     } // Example: LOGSTRING( "Test %i %i", aValue1, aValue2 );
       
   125 
       
   126 #define LOGRSTRING( AAA, BBB )    { \
       
   127                                     INTRLOGRSTRING( AAA, BBB ); \
       
   128                                     } // Example: LOGRSTRING( "Test %i", RString1 );
       
   129 
       
   130 #else   // LOGGING_ENABLED
       
   131 
       
   132 #define LOGTEXT( AAA ) 
       
   133 #define LOGSTRING( AAA ) 
       
   134 #define LOGSTRING2( AAA, BBB )    
       
   135 #define LOGSTRING3( AAA, BBB, CCC )    
       
   136 #define LOGRSTRING( AAA, BBB )
       
   137 
       
   138 #endif  // LOGGING_ENABLED
       
   139 
       
   140 // DATA TYPES
       
   141 // None.
       
   142 
       
   143 // FUNCTION PROTOTYPES
       
   144 // None.
       
   145 
       
   146 // FORWARD DECLARATIONS
       
   147 // None.
       
   148 
       
   149 // CLASS DECLARATION
       
   150 // None.
       
   151 
       
   152 #endif  // __LOGGER_H__