syncmlfw/common/sosserver/inc/PnpLogger.h
branchRCL_3
changeset 25 b183ec05bd8c
equal deleted inserted replaced
24:13d7c31c74e0 25:b183ec05bd8c
       
     1 /*
       
     2 * ==============================================================================
       
     3 *  Name        : PnpLogger.h
       
     4 *  Part of     : PnpProvisioningApp
       
     5 *  Description : This file defines logging interface macros
       
     6 *  Version     :
       
     7 *
       
     8 *  Copyright (c) 2004 Nokia Corporation.
       
     9 *  This material, including documentation and any related 
       
    10 *  computer programs, is protected by copyright controlled by 
       
    11 *  Nokia Corporation. All rights are reserved. Copying, 
       
    12 *  including reproducing, storing, adapting or translating, any 
       
    13 *  or all of this material requires the prior written consent of 
       
    14 *  Nokia Corporation. This material also contains confidential 
       
    15 *  information which may not be disclosed to others without the 
       
    16 *  prior written consent of Nokia Corporation.
       
    17 * ==============================================================================
       
    18 */
       
    19 
       
    20 #ifndef __LOGGER_H__
       
    21 #define __LOGGER_H__
       
    22 
       
    23 #ifdef _DEBUG
       
    24     #define LOGGING_ENABLED
       
    25 #endif
       
    26 #ifdef LOGGING_ENABLED          // This must be enabled to use logging system
       
    27 
       
    28 #define LOGGER_LOGGING          // Log to Logger
       
    29 
       
    30 
       
    31 
       
    32 #ifdef LOGGER_LOGGING
       
    33 
       
    34 //  INCLUDES
       
    35 #include <flogger.h>
       
    36 
       
    37 // LOG SETTINGS 
       
    38 _LIT( KPnpLogFolder, "syncml" );
       
    39 _LIT( KPnpLogFile, "syncml.TXT" );
       
    40 
       
    41 #endif
       
    42 
       
    43 // CONSTANTS  
       
    44 // None.
       
    45 
       
    46 // MACROS
       
    47 /*
       
    48 -----------------------------------------------------------------------------
       
    49 
       
    50     INTERNAL MACROs. 
       
    51 
       
    52     DO NOT USE THESE DIRECTLY !!! 
       
    53     SEE EXTERNAL MACROS
       
    54 
       
    55 -----------------------------------------------------------------------------
       
    56 */
       
    57 
       
    58 #ifdef LOGGER_LOGGING
       
    59 
       
    60 #define INTRLOGTEXT( AAA )                                                                        \
       
    61     {                                                                                            \
       
    62     RFileLogger::Write( KPnpLogFolder(), KPnpLogFile(), EFileLoggingModeAppend, AAA );            \
       
    63     }
       
    64 #define INTRLOGSTRING( AAA )                                                                    \
       
    65     {                                                                                            \
       
    66     _LIT( tempLogDes, AAA );                                                                    \
       
    67     RFileLogger::Write( KPnpLogFolder(), KPnpLogFile(), EFileLoggingModeAppend, tempLogDes() ); \
       
    68     }
       
    69 #define INTRLOGSTRING2( AAA, BBB )                                                                \
       
    70     {                                                                                            \
       
    71     _LIT( tempLogDes, AAA );                                                                    \
       
    72     RFileLogger::WriteFormat( KPnpLogFolder(), KPnpLogFile(), EFileLoggingModeAppend, TRefByValue<const TDesC>( tempLogDes()), BBB ); \
       
    73     }
       
    74 #define INTRLOGSTRING3( AAA, BBB, CCC )                                                            \
       
    75     {                                                                                            \
       
    76     _LIT( tempLogDes, AAA );                                                                    \
       
    77     RFileLogger::WriteFormat( KPnpLogFolder(), KPnpLogFile(), EFileLoggingModeAppend, TRefByValue<const TDesC>( tempLogDes()), BBB, CCC ); \
       
    78     }
       
    79 #else
       
    80 #define INTRLOGTEXT( AAA )
       
    81 #define INTRLOGSTRING( AAA )
       
    82 #define INTRLOGSTRING2( AAA, BBB )
       
    83 #define INTRLOGSTRING3( AAA, BBB, CCC )
       
    84 #endif
       
    85 
       
    86 /*
       
    87 -----------------------------------------------------------------------------
       
    88 
       
    89     EXTERNAL MACROs
       
    90 
       
    91     USE THESE MACROS IN YOUR CODE !
       
    92 
       
    93 -----------------------------------------------------------------------------
       
    94 */
       
    95 
       
    96 
       
    97 #define LOGTEXT( AAA )                { \
       
    98                                     INTRLOGTEXT( AAA ); \
       
    99                                     }   // Example: LOGTEXT( own_desc );
       
   100 
       
   101 #define LOGSTRING( AAA )            { \
       
   102                                     INTRLOGSTRING( AAA ); \
       
   103                                     }   // Example: LOGSTRING( "Test" );
       
   104 
       
   105 #define LOGSTRING2( AAA, BBB )        { \
       
   106                                     INTRLOGSTRING2( AAA, BBB ); \
       
   107                                     }  // Example: LOGSTRING( "Test %i", aValue );
       
   108 
       
   109 #define LOGSTRING3( AAA, BBB, CCC )    { \
       
   110                                     INTRLOGSTRING3( AAA, BBB, CCC ); \
       
   111                                     } // Example: LOGSTRING( "Test %i %i", aValue1, aValue2 );
       
   112 
       
   113 
       
   114 #else   // LOGGING_ENABLED
       
   115 
       
   116 #define LOGTEXT( AAA ) 
       
   117 #define LOGSTRING( AAA ) 
       
   118 #define LOGSTRING2( AAA, BBB )    
       
   119 #define LOGSTRING3( AAA, BBB, CCC )    
       
   120 
       
   121 #endif  // LOGGING_ENABLED
       
   122 
       
   123 // DATA TYPES
       
   124 // None.
       
   125 
       
   126 // FUNCTION PROTOTYPES
       
   127 // None.
       
   128 
       
   129 // FORWARD DECLARATIONS
       
   130 // None.
       
   131 
       
   132 // CLASS DECLARATION
       
   133 // None.
       
   134 
       
   135 #endif  // __LOGGER_H__