pnpmobileservices/pnpms/PnP/PnpProvisioningAppInc/PnpLogger.h
changeset 18 7d11f9a6646f
parent 4 75a71fdb4c92
child 21 c707676bf59f
equal deleted inserted replaced
4:75a71fdb4c92 18:7d11f9a6646f
     1 /*
       
     2 * Copyright (c) 2004 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 #ifdef _DEBUG
       
    23     #define LOGGING_ENABLED
       
    24 #endif
       
    25 #ifdef LOGGING_ENABLED          // This must be enabled to use logging system
       
    26 
       
    27 #define LOGGER_LOGGING          // Log to Logger
       
    28 
       
    29 
       
    30 
       
    31 #ifdef LOGGER_LOGGING
       
    32 
       
    33 //  INCLUDES
       
    34 #include <flogger.h>
       
    35 
       
    36 // LOG SETTINGS 
       
    37 _LIT( KPnpLogFolder, "PnP" );
       
    38 _LIT( KPnpLogFile, "PnPProvisioning.TXT" );
       
    39 
       
    40 #endif
       
    41 
       
    42 // CONSTANTS  
       
    43 // None.
       
    44 
       
    45 // MACROS
       
    46 /*
       
    47 -----------------------------------------------------------------------------
       
    48 
       
    49     INTERNAL MACROs. 
       
    50 
       
    51     DO NOT USE THESE DIRECTLY !!! 
       
    52     SEE EXTERNAL MACROS
       
    53 
       
    54 -----------------------------------------------------------------------------
       
    55 */
       
    56 
       
    57 #ifdef LOGGER_LOGGING
       
    58 
       
    59 #define INTRLOGTEXT( AAA )                                                                        \
       
    60     {                                                                                            \
       
    61     RFileLogger::Write( KPnpLogFolder(), KPnpLogFile(), EFileLoggingModeAppend, AAA );            \
       
    62     }
       
    63 #define INTRLOGSTRING( AAA )                                                                    \
       
    64     {                                                                                            \
       
    65     _LIT( tempLogDes, AAA );                                                                    \
       
    66     RFileLogger::Write( KPnpLogFolder(), KPnpLogFile(), EFileLoggingModeAppend, tempLogDes() ); \
       
    67     }
       
    68 #define INTRLOGSTRING2( AAA, BBB )                                                                \
       
    69     {                                                                                            \
       
    70     _LIT( tempLogDes, AAA );                                                                    \
       
    71     RFileLogger::WriteFormat( KPnpLogFolder(), KPnpLogFile(), EFileLoggingModeAppend, TRefByValue<const TDesC>( tempLogDes()), BBB ); \
       
    72     }
       
    73 #define INTRLOGSTRING3( AAA, BBB, CCC )                                                            \
       
    74     {                                                                                            \
       
    75     _LIT( tempLogDes, AAA );                                                                    \
       
    76     RFileLogger::WriteFormat( KPnpLogFolder(), KPnpLogFile(), EFileLoggingModeAppend, TRefByValue<const TDesC>( tempLogDes()), BBB, CCC ); \
       
    77     }
       
    78 #else
       
    79 #define INTRLOGTEXT( AAA )
       
    80 #define INTRLOGSTRING( AAA )
       
    81 #define INTRLOGSTRING2( AAA, BBB )
       
    82 #define INTRLOGSTRING3( AAA, BBB, CCC )
       
    83 #endif
       
    84 
       
    85 /*
       
    86 -----------------------------------------------------------------------------
       
    87 
       
    88     EXTERNAL MACROs
       
    89 
       
    90     USE THESE MACROS IN YOUR CODE !
       
    91 
       
    92 -----------------------------------------------------------------------------
       
    93 */
       
    94 
       
    95 
       
    96 #define LOGTEXT( AAA )                { \
       
    97                                     INTRLOGTEXT( AAA ); \
       
    98                                     }   // Example: LOGTEXT( own_desc );
       
    99 
       
   100 #define LOGSTRING( AAA )            { \
       
   101                                     INTRLOGSTRING( AAA ); \
       
   102                                     }   // Example: LOGSTRING( "Test" );
       
   103 
       
   104 #define LOGSTRING2( AAA, BBB )        { \
       
   105                                     INTRLOGSTRING2( AAA, BBB ); \
       
   106                                     }  // Example: LOGSTRING( "Test %i", aValue );
       
   107 
       
   108 #define LOGSTRING3( AAA, BBB, CCC )    { \
       
   109                                     INTRLOGSTRING3( AAA, BBB, CCC ); \
       
   110                                     } // Example: LOGSTRING( "Test %i %i", aValue1, aValue2 );
       
   111 
       
   112 
       
   113 #else   // LOGGING_ENABLED
       
   114 
       
   115 #define LOGTEXT( AAA ) 
       
   116 #define LOGSTRING( AAA ) 
       
   117 #define LOGSTRING2( AAA, BBB )    
       
   118 #define LOGSTRING3( AAA, BBB, CCC )    
       
   119 
       
   120 #endif  // LOGGING_ENABLED
       
   121 
       
   122 // DATA TYPES
       
   123 // None.
       
   124 
       
   125 // FUNCTION PROTOTYPES
       
   126 // None.
       
   127 
       
   128 // FORWARD DECLARATIONS
       
   129 // None.
       
   130 
       
   131 // CLASS DECLARATION
       
   132 // None.
       
   133 
       
   134 #endif  // __LOGGER_H__