simpleengine/xdmrlspres/inc/rlspresxdmlogger.h
changeset 0 c8caa15ef882
equal deleted inserted replaced
-1:000000000000 0:c8caa15ef882
       
     1 /*
       
     2 * Copyright (c) 2006 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 header is for logging purposes, only in debug.
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 
       
    20 
       
    21 
       
    22 #ifndef _RLSPRESXDMLOGGER_H
       
    23 #define _RLSPRESXDMLOGGER_H
       
    24 
       
    25 
       
    26 // logging is done only in debug
       
    27 #ifdef _DEBUG
       
    28 
       
    29 #include <flogger.h>
       
    30 #include "rlspresxdmconstsint.h"
       
    31 
       
    32 #define D_OPENG_LIT(s) _L(s)
       
    33 #define OPENG_DP OPENGDebugWriteFormat
       
    34 
       
    35 
       
    36 /**
       
    37 * Log file printing utility function
       
    38 * @since Series 60 3.0
       
    39 */
       
    40 inline void OPENGDebugWriteFormat( TRefByValue<const TDesC> aFmt,...) //lint !e960
       
    41     {
       
    42     //Use RFileLogger to write log - no time and date
       
    43     RFileLogger logger;
       
    44     logger.Connect();
       
    45                          //use date, use time
       
    46     logger.SetDateAndTime( EFalse, ETrue );
       
    47     logger.CreateLog( KPresRLSLogDir, 
       
    48                       KPresRLSLogFile, 
       
    49                       EFileLoggingModeAppend );
       
    50 
       
    51     TBuf< 256 > buffer;
       
    52 
       
    53         {
       
    54         VA_LIST list;
       
    55         VA_START (list, aFmt); //lint !e960
       
    56         TBuf< 300 > formatted;
       
    57         formatted.FormatList( aFmt, list );
       
    58         buffer.Append( formatted.Left( buffer.MaxLength() - buffer.Length() ) ); 
       
    59         }
       
    60 
       
    61     logger.Write( buffer );
       
    62     logger.CloseLog();
       
    63     logger.Close();
       
    64     }
       
    65 
       
    66 
       
    67 #else // _DEBUG
       
    68 
       
    69 struct TOPENGEmptyDebugString { };
       
    70 
       
    71 #define D_OPENG_LIT(s) TOPENGEmptyDebugString()
       
    72 
       
    73 /// Empty debug print function for release builds.
       
    74 inline void OPENG_DP(TOPENGEmptyDebugString)
       
    75     {
       
    76     }
       
    77 
       
    78 template<class T1>
       
    79 inline void OPENG_DP(TOPENGEmptyDebugString,T1)
       
    80     {
       
    81     }
       
    82 
       
    83 template<class T1,class T2>
       
    84 inline void OPENG_DP(TOPENGEmptyDebugString,T1,T2)
       
    85     {
       
    86     }
       
    87 
       
    88 template<class T1,class T2,class T3>
       
    89 inline void OPENG_DP(TOPENGEmptyDebugString,T1,T2,T3)
       
    90     {
       
    91     }
       
    92 
       
    93 template<class T1,class T2,class T3,class T4>
       
    94 inline void OPENG_DP(TOPENGEmptyDebugString,T1,T2,T3,T4)
       
    95     {
       
    96     }
       
    97 
       
    98 template<class T1,class T2,class T3,class T4,class T5>
       
    99 inline void OPENG_DP(TOPENGEmptyDebugString,T1,T2,T3,T4,T5)
       
   100     {
       
   101     }
       
   102 
       
   103 template<class T1,class T2,class T3,class T4,class T5,class T6>
       
   104 inline void OPENG_DP(TOPENGEmptyDebugString,T1,T2,T3,T4,T5,T6)
       
   105     {
       
   106     }
       
   107 
       
   108 template<class T1,class T2,class T3,class T4,class T5,class T6,class T7>
       
   109 inline void OPENG_DP(TOPENGEmptyDebugString,T1,T2,T3,T4,T5,T6,T7)
       
   110     {
       
   111     }
       
   112 
       
   113 template<class T1,class T2,class T3,class T4,class T5,class T6,class T7,class T8>
       
   114 inline void OPENG_DP(TOPENGEmptyDebugString,T1,T2,T3,T4,T5,T6,T7,T8)
       
   115     {
       
   116     }
       
   117 
       
   118 
       
   119 #endif // _DEBUG
       
   120 
       
   121 
       
   122 #endif // _RLSPRESXDMLOGGER_H
       
   123             
       
   124 // End of File