messagingfw/alwaysonline/AlwaysOnlineManager/inc/AlwaysOnlineManagerLogging.h
changeset 0 8e480a14352b
equal deleted inserted replaced
-1:000000000000 0:8e480a14352b
       
     1 /*
       
     2 * Copyright (c) 2009 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: AlwaysOnline server logging macros
       
    15 *
       
    16 */
       
    17 
       
    18 #ifndef __ALWAYSONLINEMANAGERLOGGING_H__
       
    19 #define __ALWAYSONLINEMANAGERLOGGING_H__
       
    20 
       
    21 
       
    22 #ifdef _DEBUG
       
    23 #define AOMANAGERLOGGING_ON
       
    24 #endif
       
    25 
       
    26 //#ifndef __WINS__
       
    27 // comment this if file logger is wanted
       
    28 // #define AOMANAGERLOGGING_RDEBUG
       
    29 
       
    30 //#endif
       
    31 
       
    32 #ifdef AOMANAGERLOGGING_ON
       
    33 
       
    34 #include <e32debug.h>
       
    35 #include <flogger.h>
       
    36 
       
    37 const TInt KAOEmailMajorVersion=0;
       
    38 const TInt KAOEmailMinorVersion=0;
       
    39 const TInt KAOEmailBuildVersion=1;
       
    40 
       
    41 const TInt KAOManagerLoggingTextBuffer = 255;
       
    42     
       
    43 
       
    44 #ifdef AOMANAGERLOGGING_RDEBUG
       
    45 _LIT(KAOManagerLogTag,                 "AOMAN: ");
       
    46 _LIT(KAOManagerLogTimeFormatString,    "%H:%T:%S:%*C2 ");
       
    47 
       
    48 _LIT(KAOManagerLogMessageAppBanner,"AlwaysOnlineManager %d.%d.%d   (AOMAN)");
       
    49 _LIT(KAOManagerLogEnterFn,         "AOMAN: -> %S");
       
    50 _LIT(KAOManagerLogLeaveFn,         "AOMAN: <- %S");
       
    51 _LIT(KAOManagerLogWrite,           "AOMAN: %S");
       
    52 _LIT(KAOManagerLogExitBanner,      "AlwaysOnlineEmailPlugin exit");
       
    53 #define KAOMANAGER_LOGGER_WRITE_FORMAT(a,b)   {_LIT(temp, a); TBuf<KAOManagerLoggingTextBuffer> buf; buf.Format(temp, b); buf.Insert(0, KAOManagerLogTag); RDebug::Print(buf);/*RDebug::Print(a, b);*/}		// CSI: 46 # Macro must be on one line
       
    54 #define KAOMANAGER_LOGGER_WRITE_FORMAT8(a,b)   {_LIT8(temp, a); TBuf<KAOManagerLoggingTextBuffer> buf; buf.Format(temp, b); buf.Insert(0, KAOManagerLogTag); RDebug::Print(buf);/*RDebug::Print(a, b);*/}		// CSI: 46 # see comment above
       
    55 #define KAOMANAGER_LOGGER_CREATE              {RDebug::Print(KAOManagerLogMessageAppBanner,KAOEmailMajorVersion, KAOEmailMinorVersion, KAOEmailBuildVersion);}		// CSI: 46 # see comment above
       
    56 #define KAOMANAGER_LOGGER_DELETE              {RDebug::Print(KAOManagerLogExitBanner);}
       
    57 #define KAOMANAGER_LOGGER_WRITE(a)            {_LIT(temp, a); RDebug::Print(KAOManagerLogWrite, &temp);}		// CSI: 46 # see comment above
       
    58 #define KAOMANAGER_LOGGER_WRITE_TEXT(a)       {RDebug::Print(KAOManagerLogWrite, &a);}
       
    59 #define KAOMANAGER_LOGGER_FN1(a)          {_LIT(temp, a); RDebug::Print(KAOManagerLogEnterFn, &temp);}		// CSI: 46 # see comment above
       
    60 #define KAOMANAGER_LOGGER_FN2(a)          {_LIT(temp, a); RDebug::Print(KAOManagerLogLeaveFn, &temp);}		// CSI: 46 # see comment above
       
    61 #define KAOMANAGER_LOGGER_WRITE_NUMBER(a)     {TBuf<KAOManagerLoggingTextBuffer> num; num.Num(a); RDebug::Print(KAOManagerLogWrite, &num);}		// CSI: 46 # see comment above
       
    62 #define KAOMANAGER_LOGGER_WRITE_BUFFER(a)     {TBuf<KAOManagerLoggingTextBuffer> temp; temp.Copy(a); RDebug::Print(KAOManagerLogWrite, &temp);}		// CSI: 46 # see comment above
       
    63 
       
    64 #else
       
    65 _LIT(KAOManagerLogDir,                 "AOMan");
       
    66 _LIT(KAOManagerLogFile,                "AOMan.txt");
       
    67 _LIT8(KAOManagerLogMessageAppBanner,      "AlwaysOnlineManager %d.%d.%d   (AOMAN)");
       
    68 _LIT8(KAOManagerLogEnterFn,               "-> %S");
       
    69 _LIT8(KAOManagerLogLeaveFn,               "<- %S");
       
    70 _LIT8(KAOManagerLogExit,                  "AlwaysOnlineManager exit");
       
    71 
       
    72 #define KAOMANAGER_LOGGER_CREATE              {RFileLogger::WriteFormat(KAOManagerLogDir, KAOManagerLogFile, EFileLoggingModeOverwrite, KAOManagerLogMessageAppBanner, KAOEmailMajorVersion, KAOEmailMinorVersion, KAOEmailBuildVersion);}		// CSI: 46 # see comment above
       
    73 #define KAOMANAGER_LOGGER_DELETE              {RFileLogger::WriteFormat(KAOManagerLogDir, KAOManagerLogFile, EFileLoggingModeOverwrite, KAOManagerLogMessageAppBanner, KAOEmailMajorVersion, KAOEmailMinorVersion, KAOEmailBuildVersion);}		// CSI: 46 # see comment above
       
    74     //{RFileLogger::Write(KAOManagerLogDir, KAOManagerLogFile, EFileLoggingModeAppend, KAOManagerLogExit);}
       
    75 #define KAOMANAGER_LOGGER_FN1(a)          {_LIT8(temp, a); RFileLogger::WriteFormat(KAOManagerLogDir, KAOManagerLogFile, EFileLoggingModeAppend, KAOManagerLogEnterFn, &temp);}		// CSI: 46 # see comment above
       
    76 #define KAOMANAGER_LOGGER_FN2(a)          {_LIT8(temp, a); RFileLogger::WriteFormat(KAOManagerLogDir, KAOManagerLogFile, EFileLoggingModeAppend, KAOManagerLogLeaveFn, &temp);}		// CSI: 46 # see comment above
       
    77 #define KAOMANAGER_LOGGER_WRITE(a)            {_LIT(temp, a); RFileLogger::Write(KAOManagerLogDir, KAOManagerLogFile, EFileLoggingModeAppend, temp);}		// CSI: 46 # see comment above
       
    78 #define KAOMANAGER_LOGGER_WRITE_FORMAT(a,b)   {_LIT(temp, a); RFileLogger::WriteFormat(KAOManagerLogDir, KAOManagerLogFile, EFileLoggingModeAppend, temp, b);}		// CSI: 46 # see comment above
       
    79 #define KAOMANAGER_LOGGER_WRITE_FORMAT8(a,b)   {_LIT8(temp, a); RFileLogger::WriteFormat(KAOManagerLogDir, KAOManagerLogFile, EFileLoggingModeAppend, temp, b);}		// CSI: 46 # see comment above
       
    80 #define KAOMANAGER_LOGGER_WRITE_TIMESTAMP(a)  {_LIT(temp, a); TTime time; time.HomeTime(); TBuf<256> buffer; time.FormatL( buffer, KAOManagerLogTimeFormatString ); buffer.Insert(0, temp); RFileLogger::Write(KAOManagerLogDir, KAOManagerLogFile, EFileLoggingModeAppend, buffer); }		// CSI: 46 # see comment above
       
    81 #define KAOMANAGER_LOGGER_WRITE_TEXT(a)       {RFileLogger::Write(KAOManagerLogDir, KAOManagerLogFile, EFileLoggingModeAppend, a);}		// CSI: 46 # see comment above
       
    82 #define KAOMANAGER_LOGGER_WRITE_NUMBER(a)     {TBuf<KAOManagerLoggingTextBuffer> num; num.Num(a); RFileLogger::Write(KAOManagerLogDir, KAOManagerLogFile, EFileLoggingModeAppend, num);}		// CSI: 46 # see comment above
       
    83 #define KAOMANAGER_LOGGER_WRITE_BUFFER(a)     {TBuf8<KAOManagerLoggingTextBuffer> temp; temp.Copy(a); RFileLogger::Write(KAOManagerLogDir, KAOManagerLogFile, EFileLoggingModeAppend, temp);}		// CSI: 46 # see comment above
       
    84 
       
    85 
       
    86 #endif
       
    87 
       
    88 #else
       
    89 
       
    90 #define KAOMANAGER_LOGGER_DEFINE             
       
    91 #define KAOMANAGER_LOGGER_CREATE         
       
    92 #define KAOMANAGER_LOGGER_DELETE         
       
    93 #define KAOMANAGER_LOGGER_FN1(a)     
       
    94 #define KAOMANAGER_LOGGER_FN2(a)     
       
    95 #define KAOMANAGER_LOGGER_WRITE(a)           
       
    96 #define KAOMANAGER_LOGGER_WRITE_FORMAT(a, b) 
       
    97 #define KAOMANAGER_LOGGER_WRITE_FORMAT8(a, b) 
       
    98 #define KAOMANAGER_LOGGER_WRITE_TEXT(a)
       
    99 #define KAOMANAGER_LOGGER_WRITE_NUMBER(a)
       
   100 #define KAOMANAGER_LOGGER_WRITE_FORMAT2(a, b)
       
   101 #define KAOMANAGER_LOGGER_WRITE_BUFFER(a)
       
   102 
       
   103 #endif // AOMANAGERLOGGING_ON
       
   104 
       
   105 #endif // __ALWAYSONLINEMANAGERLOGGING_H__
       
   106 
       
   107     // End of File