contextframework/cfw/inc/basicoperationsplugin/cfbasicoptrace.h
changeset 0 2e3d3ce01487
equal deleted inserted replaced
-1:000000000000 0:2e3d3ce01487
       
     1 /*
       
     2 * Copyright (c) 2007-2008 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:  Trace definitions.
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 #ifndef CFBASICOPTRACE_H
       
    20 #define CFBASICOPTRACE_H
       
    21 
       
    22 #include "cftrace.h"
       
    23 
       
    24 
       
    25 //-----------------------------------------------------------------------------
       
    26 // Constants
       
    27 //-----------------------------------------------------------------------------
       
    28 //
       
    29 
       
    30 
       
    31 /**
       
    32 * DOM prefix info trace.
       
    33 */
       
    34 #define _DOM_PREFIX_INFO( aMsg ) _PREFIX_TRACE( "[DOM_INFO]: %S : " L##aMsg )
       
    35 #define _ACTION_DOM_PREFIX_INFO( aMsg ) _PREFIX_TRACE( "[INFO]: %S : " L##aMsg )
       
    36 
       
    37 /**
       
    38 * Re-define info trace prefix used by BasicOperationsPlugIn.
       
    39 */
       
    40 #undef _PREFIX_INFO
       
    41 #define _PREFIX_INFO( aMsg ) _PREFIX_TRACE( "[DOM_INFO]: " L##aMsg )
       
    42 
       
    43 /**
       
    44 * Prefix action info trace.
       
    45 */
       
    46 #define _ACTION_PREFIX_INFO( aMsg ) _PREFIX_TRACE( "[INFO]: " L##aMsg )
       
    47 
       
    48 //-----------------------------------------------------------------------------
       
    49 // DOM info trace macro
       
    50 //-----------------------------------------------------------------------------
       
    51 //
       
    52 #ifdef DOM_INFO_TRACE
       
    53     /**
       
    54     * DOM info creation.
       
    55     */
       
    56     #define CREATE_DOM_INFO( aSelf, aNode )\
       
    57         {\
       
    58         if ( aSelf != NULL )\
       
    59             {\
       
    60             aSelf->GenerateDomTreeLocationInfoL( aNode );\
       
    61             }\
       
    62         }
       
    63 
       
    64     /**
       
    65     * DOM info log message definitions.
       
    66     */
       
    67     #ifdef TRACE_INTO_FILE
       
    68     
       
    69         #define DOM_INFO( aMsg )\
       
    70             {\
       
    71             if ( iDomTreeLocationInfo != NULL )\
       
    72                 {\
       
    73                 TPtrC info( *iDomTreeLocationInfo );\
       
    74                 RFileLogger::WriteFormat( KDir, KFile, EFileLoggingModeAppend, _DOM_PREFIX_INFO( aMsg ), &info );\
       
    75                 }\
       
    76             }
       
    77         #define ACTION_DOM_INFO( aMsg )\
       
    78             {\
       
    79             if ( iDomTreeLocationInfo != NULL )\
       
    80                 {\
       
    81                 TPtrC info( *iDomTreeLocationInfo );\
       
    82                 RFileLogger::WriteFormat( KDir, KFile, EFileLoggingModeAppend, _ACTION_DOM_PREFIX_INFO( aMsg ), &info );\
       
    83                 }\
       
    84             }
       
    85 
       
    86     #else//TRACE_INTO_FILE not defined
       
    87 
       
    88         #define DOM_INFO( aMsg )\
       
    89             {\
       
    90             if ( iDomTreeLocationInfo != NULL )\
       
    91                 {\
       
    92                 TPtrC info( *iDomTreeLocationInfo );\
       
    93                 RDebug::Print( _DOM_PREFIX_INFO( aMsg ), &info );\
       
    94                 }\
       
    95             }
       
    96         #define ACTION_DOM_INFO( aMsg )\
       
    97             {\
       
    98             if ( iDomTreeLocationInfo != NULL )\
       
    99                 {\
       
   100                 TPtrC info( *iDomTreeLocationInfo );\
       
   101                 RDebug::Print( _ACTION_DOM_PREFIX_INFO( aMsg ), &info );\
       
   102                 }\
       
   103             }
       
   104 
       
   105     #endif // TRACE_INTO_FILE
       
   106 
       
   107 #else // DOM_INFO_TRACE not defined
       
   108     #define CREATE_DOM_INFO( aSelf, aNode )
       
   109     #define DOM_INFO( aMsg )
       
   110     #define ACTION_DOM_INFO( aMsg )
       
   111 #endif // DOM_INFO_TRACE
       
   112 
       
   113 
       
   114 //-----------------------------------------------------------------------------
       
   115 // Action info trace macros
       
   116 //-----------------------------------------------------------------------------
       
   117 //
       
   118 #ifdef INFO_TRACE
       
   119 
       
   120     /**
       
   121     * Action info log message definitions.
       
   122     * Create normal INFO trace messages that need to be generated from action
       
   123     * firing functions.
       
   124     */
       
   125     #ifdef TRACE_INTO_FILE
       
   126     
       
   127         #define ACTION_INFO( aMsg )\
       
   128             {\
       
   129             RFileLogger::Write( KDir, KFile, EFileLoggingModeAppend, _ACTION_PREFIX_INFO( aMsg ) );\
       
   130             }
       
   131         #define ACTION_INFO_1( aMsg, aP1 )\
       
   132             {\
       
   133             RFileLogger::WriteFormat( KDir, KFile, EFileLoggingModeAppend, _ACTION_PREFIX_INFO( aMsg ), aP1 );\
       
   134             }
       
   135         #define ACTION_INFO_2( aMsg, aP1, aP2 )\
       
   136             {\
       
   137             RFileLogger::WriteFormat( KDir, KFile, EFileLoggingModeAppend, _ACTION_PREFIX_INFO( aMsg ), aP1, aP2 );\
       
   138             }
       
   139         #define ACTION_INFO_3( aMsg, aP1, aP2, aP3 )\
       
   140             {\
       
   141             RFileLogger::WriteFormat( KDir, KFile, EFileLoggingModeAppend, _ACTION_PREFIX_INFO( aMsg ), aP1, aP2, aP3 );\
       
   142             }
       
   143         #define ACTION_INFO_4( aMsg, aP1, aP2, aP3, aP4 )\
       
   144             {\
       
   145             RFileLogger::WriteFormat( KDir, KFile, EFileLoggingModeAppend, _ACTION_PREFIX_INFO( aMsg ), aP1, aP2, aP3, aP4 );\
       
   146             }
       
   147 
       
   148     #else//TRACE_INTO_FILE not defined
       
   149 
       
   150         #define ACTION_INFO( aMsg )\
       
   151             {\
       
   152             RDebug::Print( _ACTION_PREFIX_INFO( aMsg ) );\
       
   153             }
       
   154         #define ACTION_INFO_1( aMsg, aP1 )\
       
   155             {\
       
   156             RDebug::Print( _ACTION_PREFIX_INFO( aMsg ), aP1 );\
       
   157             }
       
   158         #define ACTION_INFO_2( aMsg, aP1, aP2 )\
       
   159             {\
       
   160             RDebug::Print( _ACTION_PREFIX_INFO( aMsg ), aP1, aP2 );\
       
   161             }
       
   162         #define ACTION_INFO_3( aMsg, aP1, aP2, aP3 )\
       
   163             {\
       
   164             RDebug::Print( _ACTION_PREFIX_INFO( aMsg ), aP1, aP2, aP3 );\
       
   165             }
       
   166         #define ACTION_INFO_4( aMsg, aP1, aP2, aP3, aP4 )\
       
   167             {\
       
   168             RDebug::Print( _ACTION_PREFIX_INFO( aMsg ), aP1, aP2, aP3, aP4 );\
       
   169             }
       
   170 
       
   171     #endif//TRACE_INTO_FILE
       
   172         
       
   173 #else//INFO_TRACE not defined
       
   174 
       
   175     #define ACTION_INFO( aMsg )
       
   176     #define ACTION_INFO_1( aMsg, aP1 )
       
   177     #define ACTION_INFO_2( aMsg, aP1, aP2 )
       
   178     #define ACTION_INFO_3( aMsg, aP1, aP2, aP3 )
       
   179     #define ACTION_INFO_4( aMsg, aP1, aP2, aP3, aP4 )
       
   180 
       
   181 #endif//INFO_TRACE
       
   182 
       
   183 
       
   184 #endif // CFBASICOPTRACE_H