messagingfw/alwaysonline/AlwaysOnlineStarterApp/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 #ifndef __ALWAYSONLINEMANAGERLOGGING_H__
       
    18 #define __ALWAYSONLINEMANAGERLOGGING_H__
       
    19 
       
    20 
       
    21 #ifdef _DEBUG
       
    22 #define AOMANAGERLOGGING_ON
       
    23 #endif
       
    24 
       
    25 //#ifndef __WINS__
       
    26 // comment this if file logger is wanted
       
    27 //#define AOMANAGERLOGGING_RDEBUG
       
    28 
       
    29 //#endif
       
    30 
       
    31 #ifdef AOMANAGERLOGGING_ON
       
    32 
       
    33 #include <flogger.h>
       
    34 
       
    35 const TInt KAOEmailMajorVersion=0;
       
    36 const TInt KAOEmailMinorVersion=0;
       
    37 const TInt KAOEmailBuildVersion=1;
       
    38 
       
    39 const TInt KAOManagerLoggingTextBuffer = 255;
       
    40     
       
    41 
       
    42 #ifdef AOMANAGERLOGGING_RDEBUG
       
    43 _LIT(KAOManagerLogTag,                 "AOMStarter: ");
       
    44 _LIT(KAOManagerLogTimeFormatString,    "%H:%T:%S:%*C2 ");
       
    45 
       
    46 _LIT(KAOManagerLogMessageAppBanner,"AlwaysOnlineManager %d.%d.%d   (AOMStarter)");
       
    47 _LIT(KAOManagerLogEnterFn,         "AOMStarter: -> %S");
       
    48 _LIT(KAOManagerLogLeaveFn,         "AOMStarter: <- %S");
       
    49 _LIT(KAOManagerLogWrite,           "AOMStarter: %S");
       
    50 _LIT(KAOManagerLogExitBanner,      "AOMStarter exit");
       
    51 #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
       
    52 #define KAOMANAGER_LOGGER_CREATE              {RDebug::Print(KAOManagerLogMessageAppBanner,KAOEmailMajorVersion, KAOEmailMinorVersion, KAOEmailBuildVersion);}		// CSI: 46 # see comment above
       
    53 #define KAOMANAGER_LOGGER_DELETE              {RDebug::Print(KAOManagerLogExitBanner);}
       
    54 #define KAOMANAGER_LOGGER_WRITE(a)            {_LIT(temp, a); RDebug::Print(KAOManagerLogWrite, &temp);}		// CSI: 46 # see comment above
       
    55 #define KAOMANAGER_LOGGER_WRITE_TEXT(a)       {RDebug::Print(KAOManagerLogWrite, &a);}
       
    56 #define KAOMANAGER_LOGGER_FN1(a)          {_LIT(temp, a); RDebug::Print(KAOManagerLogEnterFn, &temp);}		// CSI: 46 # see comment above
       
    57 #define KAOMANAGER_LOGGER_FN2(a)          {_LIT(temp, a); RDebug::Print(KAOManagerLogLeaveFn, &temp);}		// CSI: 46 # see comment above
       
    58 #define KAOMANAGER_LOGGER_WRITE_NUMBER(a)     {TBuf<KAOManagerLoggingTextBuffer> num; num.Num(a); RDebug::Print(KAOManagerLogWrite, &num);}		// CSI: 46 # see comment above
       
    59 #define KAOMANAGER_LOGGER_WRITE_BUFFER(a)     {TBuf<KAOManagerLoggingTextBuffer> temp; temp.Copy(a); RDebug::Print(KAOManagerLogWrite, &temp);}		// CSI: 46 # see comment above
       
    60 
       
    61 #else
       
    62 _LIT(KAOManagerLogDir,                 "AOMStarter");
       
    63 _LIT(KAOManagerLogFile,                "AOMStarter.txt");
       
    64 _LIT8(KAOManagerLogMessageAppBanner,      "AlwaysOnlineManager %d.%d.%d   (AOMStarter)");
       
    65 _LIT8(KAOManagerLogEnterFn,               "-> %S");
       
    66 _LIT8(KAOManagerLogLeaveFn,               "<- %S");
       
    67 _LIT8(KAOManagerLogExit,                  "AOMStarter exit");
       
    68 
       
    69 #define KAOMANAGER_LOGGER_CREATE              {RFileLogger::WriteFormat(KAOManagerLogDir, KAOManagerLogFile, EFileLoggingModeOverwrite, KAOManagerLogMessageAppBanner, KAOEmailMajorVersion, KAOEmailMinorVersion, KAOEmailBuildVersion);}		// CSI: 46 # see comment above
       
    70 #define KAOMANAGER_LOGGER_DELETE              {RFileLogger::WriteFormat(KAOManagerLogDir, KAOManagerLogFile, EFileLoggingModeOverwrite, KAOManagerLogMessageAppBanner, KAOEmailMajorVersion, KAOEmailMinorVersion, KAOEmailBuildVersion);}		// CSI: 46 # see comment above
       
    71     //{RFileLogger::Write(KAOManagerLogDir, KAOManagerLogFile, EFileLoggingModeAppend, KAOManagerLogExit);}
       
    72 #define KAOMANAGER_LOGGER_FN1(a)          {_LIT8(temp, a); RFileLogger::WriteFormat(KAOManagerLogDir, KAOManagerLogFile, EFileLoggingModeAppend, KAOManagerLogEnterFn, &temp);}		// CSI: 46 # see comment above
       
    73 #define KAOMANAGER_LOGGER_FN2(a)          {_LIT8(temp, a); RFileLogger::WriteFormat(KAOManagerLogDir, KAOManagerLogFile, EFileLoggingModeAppend, KAOManagerLogLeaveFn, &temp);}		// CSI: 46 # see comment above
       
    74 #define KAOMANAGER_LOGGER_WRITE(a)            {_LIT(temp, a); RFileLogger::Write(KAOManagerLogDir, KAOManagerLogFile, EFileLoggingModeAppend, temp);}		// CSI: 46 # see comment above
       
    75 #define KAOMANAGER_LOGGER_WRITE_FORMAT(a,b)   {_LIT(temp, a); RFileLogger::WriteFormat(KAOManagerLogDir, KAOManagerLogFile, EFileLoggingModeAppend, temp, b);}		// CSI: 46 # see comment above
       
    76 #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
       
    77 #define KAOMANAGER_LOGGER_WRITE_TEXT(a)       {RFileLogger::Write(KAOManagerLogDir, KAOManagerLogFile, EFileLoggingModeAppend, a);}		// CSI: 46 # see comment above
       
    78 #define KAOMANAGER_LOGGER_WRITE_NUMBER(a)     {TBuf<KAOManagerLoggingTextBuffer> num; num.Num(a); RFileLogger::Write(KAOManagerLogDir, KAOManagerLogFile, EFileLoggingModeAppend, num);}		// CSI: 46 # see comment above
       
    79 #define KAOMANAGER_LOGGER_WRITE_BUFFER(a)     {TBuf8<KAOManagerLoggingTextBuffer> temp; temp.Copy(a); RFileLogger::Write(KAOManagerLogDir, KAOManagerLogFile, EFileLoggingModeAppend, temp);}		// CSI: 46 # see comment above
       
    80 
       
    81 
       
    82 #endif
       
    83 
       
    84 #else
       
    85 
       
    86 #define KAOMANAGER_LOGGER_DEFINE             
       
    87 #define KAOMANAGER_LOGGER_CREATE         
       
    88 #define KAOMANAGER_LOGGER_DELETE         
       
    89 #define KAOMANAGER_LOGGER_FN1(a)     
       
    90 #define KAOMANAGER_LOGGER_FN2(a)     
       
    91 #define KAOMANAGER_LOGGER_WRITE(a)           
       
    92 #define KAOMANAGER_LOGGER_WRITE_FORMAT(a, b) 
       
    93 #define KAOMANAGER_LOGGER_WRITE_TEXT(a)
       
    94 #define KAOMANAGER_LOGGER_WRITE_NUMBER(a)
       
    95 #define KAOMANAGER_LOGGER_WRITE_FORMAT2(a, b)
       
    96 #define KAOMANAGER_LOGGER_WRITE_BUFFER(a)
       
    97 
       
    98 #endif // _MCE_LOGGING_
       
    99 
       
   100 #endif // __LOGTEXT_H__
       
   101 
       
   102     // End of File