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