policymanagement/policyengine/policyengineui/inc/Logger.h
author hgs
Tue, 13 Jul 2010 09:51:41 +0530
changeset 51 2e64dc50f295
permissions -rw-r--r--
201025_02
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
51
2e64dc50f295 201025_02
hgs
parents:
diff changeset
     1
/*
2e64dc50f295 201025_02
hgs
parents:
diff changeset
     2
* Copyright (c) 2000 Nokia Corporation and/or its subsidiary(-ies). 
2e64dc50f295 201025_02
hgs
parents:
diff changeset
     3
* All rights reserved.
2e64dc50f295 201025_02
hgs
parents:
diff changeset
     4
* This component and the accompanying materials are made available
2e64dc50f295 201025_02
hgs
parents:
diff changeset
     5
* under the terms of "Eclipse Public License v1.0"
2e64dc50f295 201025_02
hgs
parents:
diff changeset
     6
* which accompanies this distribution, and is available
2e64dc50f295 201025_02
hgs
parents:
diff changeset
     7
* at the URL "http://www.eclipse.org/legal/epl-v10.html".
2e64dc50f295 201025_02
hgs
parents:
diff changeset
     8
*
2e64dc50f295 201025_02
hgs
parents:
diff changeset
     9
* Initial Contributors:
2e64dc50f295 201025_02
hgs
parents:
diff changeset
    10
* Nokia Corporation - initial contribution.
2e64dc50f295 201025_02
hgs
parents:
diff changeset
    11
*
2e64dc50f295 201025_02
hgs
parents:
diff changeset
    12
* Contributors:
2e64dc50f295 201025_02
hgs
parents:
diff changeset
    13
*
2e64dc50f295 201025_02
hgs
parents:
diff changeset
    14
* Description: Implementation of policymanagement components
2e64dc50f295 201025_02
hgs
parents:
diff changeset
    15
*
2e64dc50f295 201025_02
hgs
parents:
diff changeset
    16
*/
2e64dc50f295 201025_02
hgs
parents:
diff changeset
    17
2e64dc50f295 201025_02
hgs
parents:
diff changeset
    18
#ifndef __LOGGER_H__
2e64dc50f295 201025_02
hgs
parents:
diff changeset
    19
#define __LOGGER_H__
2e64dc50f295 201025_02
hgs
parents:
diff changeset
    20
2e64dc50f295 201025_02
hgs
parents:
diff changeset
    21
#ifdef _DEBUG
2e64dc50f295 201025_02
hgs
parents:
diff changeset
    22
    #define LOGGING_ENABLED
2e64dc50f295 201025_02
hgs
parents:
diff changeset
    23
#endif
2e64dc50f295 201025_02
hgs
parents:
diff changeset
    24
#ifdef LOGGING_ENABLED          // This must be enabled to use logging system
2e64dc50f295 201025_02
hgs
parents:
diff changeset
    25
2e64dc50f295 201025_02
hgs
parents:
diff changeset
    26
#define LOGGER_LOGGING          // Log to Logger
2e64dc50f295 201025_02
hgs
parents:
diff changeset
    27
2e64dc50f295 201025_02
hgs
parents:
diff changeset
    28
2e64dc50f295 201025_02
hgs
parents:
diff changeset
    29
2e64dc50f295 201025_02
hgs
parents:
diff changeset
    30
#ifdef LOGGER_LOGGING
2e64dc50f295 201025_02
hgs
parents:
diff changeset
    31
2e64dc50f295 201025_02
hgs
parents:
diff changeset
    32
//  INCLUDES
2e64dc50f295 201025_02
hgs
parents:
diff changeset
    33
#include <flogger.h>
2e64dc50f295 201025_02
hgs
parents:
diff changeset
    34
2e64dc50f295 201025_02
hgs
parents:
diff changeset
    35
// LOG SETTINGS 
2e64dc50f295 201025_02
hgs
parents:
diff changeset
    36
_LIT( KPMUILogFolder, "TARM" );
2e64dc50f295 201025_02
hgs
parents:
diff changeset
    37
_LIT( KPMUILogFile, "PMUI.TXT" );
2e64dc50f295 201025_02
hgs
parents:
diff changeset
    38
2e64dc50f295 201025_02
hgs
parents:
diff changeset
    39
#endif
2e64dc50f295 201025_02
hgs
parents:
diff changeset
    40
2e64dc50f295 201025_02
hgs
parents:
diff changeset
    41
// CONSTANTS  
2e64dc50f295 201025_02
hgs
parents:
diff changeset
    42
// None.
2e64dc50f295 201025_02
hgs
parents:
diff changeset
    43
2e64dc50f295 201025_02
hgs
parents:
diff changeset
    44
// MACROS
2e64dc50f295 201025_02
hgs
parents:
diff changeset
    45
/*
2e64dc50f295 201025_02
hgs
parents:
diff changeset
    46
-----------------------------------------------------------------------------
2e64dc50f295 201025_02
hgs
parents:
diff changeset
    47
2e64dc50f295 201025_02
hgs
parents:
diff changeset
    48
    INTERNAL MACROs. 
2e64dc50f295 201025_02
hgs
parents:
diff changeset
    49
2e64dc50f295 201025_02
hgs
parents:
diff changeset
    50
    DO NOT USE THESE DIRECTLY !!! 
2e64dc50f295 201025_02
hgs
parents:
diff changeset
    51
    SEE EXTERNAL MACROS
2e64dc50f295 201025_02
hgs
parents:
diff changeset
    52
2e64dc50f295 201025_02
hgs
parents:
diff changeset
    53
-----------------------------------------------------------------------------
2e64dc50f295 201025_02
hgs
parents:
diff changeset
    54
*/
2e64dc50f295 201025_02
hgs
parents:
diff changeset
    55
2e64dc50f295 201025_02
hgs
parents:
diff changeset
    56
#ifdef LOGGER_LOGGING
2e64dc50f295 201025_02
hgs
parents:
diff changeset
    57
2e64dc50f295 201025_02
hgs
parents:
diff changeset
    58
_LIT( KTextFormat, "%S%S" );
2e64dc50f295 201025_02
hgs
parents:
diff changeset
    59
_LIT( KPnpUtil, "PnpUtil| " );
2e64dc50f295 201025_02
hgs
parents:
diff changeset
    60
2e64dc50f295 201025_02
hgs
parents:
diff changeset
    61
#define INTRLOGTEXT( AAA )                                                                                        \
2e64dc50f295 201025_02
hgs
parents:
diff changeset
    62
    {                                                                                                            \
2e64dc50f295 201025_02
hgs
parents:
diff changeset
    63
    RFileLogger::Write( KPMUILogFolder(), KPMUILogFile(), EFileLoggingModeAppend, AAA );            \
2e64dc50f295 201025_02
hgs
parents:
diff changeset
    64
    }
2e64dc50f295 201025_02
hgs
parents:
diff changeset
    65
#define INTRLOGSTRING( AAA )                                                                                    \
2e64dc50f295 201025_02
hgs
parents:
diff changeset
    66
    {                                                                                                            \
2e64dc50f295 201025_02
hgs
parents:
diff changeset
    67
    _LIT( tempLogDes, AAA );                                                                                    \
2e64dc50f295 201025_02
hgs
parents:
diff changeset
    68
    RFileLogger::Write( KPMUILogFolder(), KPMUILogFile(), EFileLoggingModeAppend, tempLogDes() );    \
2e64dc50f295 201025_02
hgs
parents:
diff changeset
    69
    }
2e64dc50f295 201025_02
hgs
parents:
diff changeset
    70
// 20 chars is left for the formatted item
2e64dc50f295 201025_02
hgs
parents:
diff changeset
    71
#define INTRLOGSTRING2( AAA, BBB )                                                                                \
2e64dc50f295 201025_02
hgs
parents:
diff changeset
    72
    {                                                                                                            \
2e64dc50f295 201025_02
hgs
parents:
diff changeset
    73
    _LIT( tempLogDes, AAA );                                                                                    \
2e64dc50f295 201025_02
hgs
parents:
diff changeset
    74
    RFileLogger::WriteFormat( KPMUILogFolder(), KPMUILogFile(), EFileLoggingModeAppend, TRefByValue<const TDesC>( tempLogDes()), BBB ); \
2e64dc50f295 201025_02
hgs
parents:
diff changeset
    75
    }
2e64dc50f295 201025_02
hgs
parents:
diff changeset
    76
// 40 chars is left for the formatted items
2e64dc50f295 201025_02
hgs
parents:
diff changeset
    77
#define INTRLOGSTRING3( AAA, BBB, CCC )                                                                            \
2e64dc50f295 201025_02
hgs
parents:
diff changeset
    78
    {                                                                                                            \
2e64dc50f295 201025_02
hgs
parents:
diff changeset
    79
    _LIT( tempLogDes, AAA );                                                                                    \
2e64dc50f295 201025_02
hgs
parents:
diff changeset
    80
    RFileLogger::WriteFormat( KPMUILogFolder(), KPMUILogFile(), EFileLoggingModeAppend, TRefByValue<const TDesC>( tempLogDes()), BBB, CCC ); \
2e64dc50f295 201025_02
hgs
parents:
diff changeset
    81
    }
2e64dc50f295 201025_02
hgs
parents:
diff changeset
    82
#else
2e64dc50f295 201025_02
hgs
parents:
diff changeset
    83
#define INTRLOGTEXT( AAA )
2e64dc50f295 201025_02
hgs
parents:
diff changeset
    84
#define INTRLOGSTRING( AAA )
2e64dc50f295 201025_02
hgs
parents:
diff changeset
    85
#define INTRLOGSTRING2( AAA, BBB )
2e64dc50f295 201025_02
hgs
parents:
diff changeset
    86
#define INTRLOGSTRING3( AAA, BBB, CCC )
2e64dc50f295 201025_02
hgs
parents:
diff changeset
    87
#endif
2e64dc50f295 201025_02
hgs
parents:
diff changeset
    88
2e64dc50f295 201025_02
hgs
parents:
diff changeset
    89
/*
2e64dc50f295 201025_02
hgs
parents:
diff changeset
    90
-----------------------------------------------------------------------------
2e64dc50f295 201025_02
hgs
parents:
diff changeset
    91
2e64dc50f295 201025_02
hgs
parents:
diff changeset
    92
    EXTERNAL MACROs
2e64dc50f295 201025_02
hgs
parents:
diff changeset
    93
2e64dc50f295 201025_02
hgs
parents:
diff changeset
    94
    USE THESE MACROS IN YOUR CODE !
2e64dc50f295 201025_02
hgs
parents:
diff changeset
    95
2e64dc50f295 201025_02
hgs
parents:
diff changeset
    96
-----------------------------------------------------------------------------
2e64dc50f295 201025_02
hgs
parents:
diff changeset
    97
*/
2e64dc50f295 201025_02
hgs
parents:
diff changeset
    98
2e64dc50f295 201025_02
hgs
parents:
diff changeset
    99
2e64dc50f295 201025_02
hgs
parents:
diff changeset
   100
#define LOGTEXT( AAA )                { \
2e64dc50f295 201025_02
hgs
parents:
diff changeset
   101
                                    INTRLOGTEXT( AAA ); \
2e64dc50f295 201025_02
hgs
parents:
diff changeset
   102
                                    }   // Example: LOGTEXT( own_desc );
2e64dc50f295 201025_02
hgs
parents:
diff changeset
   103
2e64dc50f295 201025_02
hgs
parents:
diff changeset
   104
#define LOGSTRING( AAA )            { \
2e64dc50f295 201025_02
hgs
parents:
diff changeset
   105
                                    INTRLOGSTRING( AAA ); \
2e64dc50f295 201025_02
hgs
parents:
diff changeset
   106
                                    }   // Example: LOGSTRING( "Test" );
2e64dc50f295 201025_02
hgs
parents:
diff changeset
   107
2e64dc50f295 201025_02
hgs
parents:
diff changeset
   108
#define LOGSTRING2( AAA, BBB )        { \
2e64dc50f295 201025_02
hgs
parents:
diff changeset
   109
                                    INTRLOGSTRING2( AAA, BBB ); \
2e64dc50f295 201025_02
hgs
parents:
diff changeset
   110
                                    }  // Example: LOGSTRING( "Test %i", aValue );
2e64dc50f295 201025_02
hgs
parents:
diff changeset
   111
2e64dc50f295 201025_02
hgs
parents:
diff changeset
   112
#define LOGSTRING3( AAA, BBB, CCC )    { \
2e64dc50f295 201025_02
hgs
parents:
diff changeset
   113
                                    INTRLOGSTRING3( AAA, BBB, CCC ); \
2e64dc50f295 201025_02
hgs
parents:
diff changeset
   114
                                    } // Example: LOGSTRING( "Test %i %i", aValue1, aValue2 );
2e64dc50f295 201025_02
hgs
parents:
diff changeset
   115
2e64dc50f295 201025_02
hgs
parents:
diff changeset
   116
2e64dc50f295 201025_02
hgs
parents:
diff changeset
   117
#else   // LOGGING_ENABLED
2e64dc50f295 201025_02
hgs
parents:
diff changeset
   118
2e64dc50f295 201025_02
hgs
parents:
diff changeset
   119
#define LOGTEXT( AAA ) 
2e64dc50f295 201025_02
hgs
parents:
diff changeset
   120
#define LOGSTRING( AAA ) 
2e64dc50f295 201025_02
hgs
parents:
diff changeset
   121
#define LOGSTRING2( AAA, BBB )    
2e64dc50f295 201025_02
hgs
parents:
diff changeset
   122
#define LOGSTRING3( AAA, BBB, CCC )    
2e64dc50f295 201025_02
hgs
parents:
diff changeset
   123
2e64dc50f295 201025_02
hgs
parents:
diff changeset
   124
#endif  // LOGGING_ENABLED
2e64dc50f295 201025_02
hgs
parents:
diff changeset
   125
2e64dc50f295 201025_02
hgs
parents:
diff changeset
   126
// DATA TYPES
2e64dc50f295 201025_02
hgs
parents:
diff changeset
   127
// None.
2e64dc50f295 201025_02
hgs
parents:
diff changeset
   128
2e64dc50f295 201025_02
hgs
parents:
diff changeset
   129
// FUNCTION PROTOTYPES
2e64dc50f295 201025_02
hgs
parents:
diff changeset
   130
// None.
2e64dc50f295 201025_02
hgs
parents:
diff changeset
   131
2e64dc50f295 201025_02
hgs
parents:
diff changeset
   132
// FORWARD DECLARATIONS
2e64dc50f295 201025_02
hgs
parents:
diff changeset
   133
// None.
2e64dc50f295 201025_02
hgs
parents:
diff changeset
   134
2e64dc50f295 201025_02
hgs
parents:
diff changeset
   135
// CLASS DECLARATION
2e64dc50f295 201025_02
hgs
parents:
diff changeset
   136
// None.
2e64dc50f295 201025_02
hgs
parents:
diff changeset
   137
2e64dc50f295 201025_02
hgs
parents:
diff changeset
   138
#endif  // __LOGGER_H__