emailservices/emaildebug/inc/emailtrace.h
changeset 18 578830873419
parent 0 8466d47a6819
child 27 9ba4404ef423
--- a/emailservices/emaildebug/inc/emailtrace.h	Tue Feb 02 00:02:40 2010 +0200
+++ b/emailservices/emaildebug/inc/emailtrace.h	Fri Apr 16 14:51:52 2010 +0300
@@ -21,7 +21,6 @@
 #include "emailtraceconfig.hrh"
 
 #ifdef TRACE_INTO_FILE
-#include "cmaillogger.h"
 #include <flogger.h> // RFileLogger
 #else
 #include <e32debug.h> // RDebug
@@ -30,31 +29,23 @@
 /**
 * Constants
 */
-#if defined(TRACE_INTO_FILE)
+#ifdef TRACE_INTO_FILE
 
     _LIT(  KEmailDir, "email" );
     _LIT(  KEmailTraceFile, "email.txt" );
 
 #endif
 
-#if defined(TRACE_FILE_LIMIT_SIZE)
-    #define CMAIL_LOG_CLOSE CmailLogger::Close();
-    #define CMAILLOGBUFFERSIZE 120
-#else
-    #define CMAIL_LOG_CLOSE 
-#endif
-
 //-----------------------------------------------------------------------------
 // Error trace macros
 //-----------------------------------------------------------------------------
 //
-
 #ifdef ERROR_TRACE
 
     /**
     * Error trace definitions. Does not automatically log the error code!
-    */    
-    #if defined(TRACE_INTO_FILE) && !defined(TRACE_FILE_LIMIT_SIZE)
+    */
+    #ifdef TRACE_INTO_FILE
 
         #define ERROR( aErr, aMsg )\
             {\
@@ -90,36 +81,8 @@
             }
         #define ERROR_GEN( aMsg ) ERROR( KErrGeneral, aMsg )
         #define ERROR_GEN_1( aMsg, aP1 ) ERROR_1( KErrGeneral, aMsg, aP1 )
-    #endif
-    #if defined(TRACE_INTO_FILE) && defined(TRACE_FILE_LIMIT_SIZE)
-    
-        #define ERROR( aErr, aMsg )\
-        {\
-            if( aErr != KErrNone )\
-            {\
-            _LIT8( KMsg, aMsg );TBuf8<CMAILLOGBUFFERSIZE> buf=KMsg(); if ( KMsg().Size() < buf.MaxSize() ) { CmailLogger::Write( buf ); }}\
-        }    
-    
-    #define ERROR_1( aErr, aMsg, aP1 )\
-        {\
-            if( aErr != KErrNone )\
-            {\
-            _LIT8( KMsg, aMsg );TBuf8<CMAILLOGBUFFERSIZE> buf=KNullDesC8(); if ( KMsg().Size() < buf.MaxSize() ) { buf.Format( KMsg, aP1 ); CmailLogger::Write( buf ); } }\
-        }    
-        #define ERROR_2( aErr, aMsg, aP1, aP2 )\
-        {\
-            if( aErr != KErrNone )\
-            {\
-            _LIT8( KMsg, aMsg );TBuf8<CMAILLOGBUFFERSIZE> buf=KNullDesC8(); if ( KMsg().Size() < buf.MaxSize() ) { buf.Format( KMsg, aP1, aP2 ); CmailLogger::Write( buf ); }} \
-        }    
-        #define ERROR_3( aErr, aMsg, aP1, aP2, aP3 )\
-        {\
-            if( aErr != KErrNone )\
-            {\
-            _LIT8( KMsg, aMsg );TBuf8<CMAILLOGBUFFERSIZE> buf=KNullDesC8(); if ( KMsg().Size() < buf.MaxSize() ) { buf.Format( KMsg, aP1, aP2, aP3 ); CmailLogger::Write( buf ); }}\
-        }        
-    #endif
-    #if !defined(TRACE_INTO_FILE) && !defined(TRACE_FILE_LIMIT_SIZE)
+
+    #else//TRACE_INTO_FILE not defined
 
         #define ERROR( aErr, aMsg )\
             {\
@@ -165,17 +128,16 @@
 
 #endif//ERROR_TRACE
 
-
 //-----------------------------------------------------------------------------
 // Info trace macros
 //-----------------------------------------------------------------------------
 //
-#if defined(INFO_TRACE)
+#ifdef INFO_TRACE
 
     /**
     * Info log message definitions.
     */
-    #if defined(TRACE_INTO_FILE) && !defined(TRACE_FILE_LIMIT_SIZE)
+    #ifdef TRACE_INTO_FILE
 
         #define INFO( aMsg )\
             {\
@@ -197,30 +159,8 @@
             _LIT( KMsg, aMsg );\
             RFileLogger::WriteFormat(  KEmailDir,  KEmailTraceFile, EFileLoggingModeAppend, KMsg, aP1, aP2, aP3 );\
             }
-    #endif // // TRACE_INTO_FILE && TRACE_FILE_LIMIT_SIZE
-    
-    #if defined(TRACE_INTO_FILE) && defined(TRACE_FILE_LIMIT_SIZE)
-        #define CMAIL_LOG_INIT
-        
-        #define INFO( aMsg )\
-            {\
-            _LIT8( KMsg, aMsg );\
-            CmailLogger::Write( KMsg );\
-            }
-        #define INFO_1( aMsg, aP1 )\
-            { _LIT8( KMsg, aMsg );TBuf8<CMAILLOGBUFFERSIZE> buf=KNullDesC8();\
-             if ( KMsg().Size() < buf.MaxSize() ) { buf.Format( KMsg, aP1 ); }\
-                CmailLogger::Write( buf ); }
-        #define INFO_2( aMsg, aP1, aP2 )\
-            { _LIT8( KMsg, aMsg );TBuf8<CMAILLOGBUFFERSIZE> buf=KNullDesC8();\
-             if ( KMsg().Size() < buf.MaxSize() ) { buf.Format( KMsg, aP1,aP2 ); }\
-                CmailLogger::Write( buf ); }
-        #define INFO_3( aMsg, aP1, aP2, aP3 )\
-            { _LIT8( KMsg, aMsg );TBuf8<CMAILLOGBUFFERSIZE> buf=KNullDesC8();\
-             if ( KMsg().Size() < buf.MaxSize() ) { buf.Format( KMsg, aP1,aP2,aP3 ); }\
-                CmailLogger::Write( buf ); }
-    #endif // TRACE_INTO_FILE && TRACE_FILE_LIMIT_SIZE
-    #if !defined(TRACE_INTO_FILE)
+
+    #else//TRACE_INTO_FILE not defined
 
         #define INFO( aMsg )\
             {\
@@ -240,11 +180,9 @@
             }
 
     #endif//TRACE_INTO_FILE
-                           
+
 #else//INFO_TRACE not defined
-    
-    #define CMAIL_LOG_INIT
-    #define CMAIL_LOG_CLOSE
+
     #define INFO( aMsg )
     #define INFO_1( aMsg, aP1 )
     #define INFO_2( aMsg, aP1, aP2 )
@@ -256,36 +194,30 @@
 // Function trace macros
 //-----------------------------------------------------------------------------
 //
- 
-#if defined (FUNC_TRACE)
+#ifdef FUNC_TRACE
 
     // Constants
     _LIT8( KEllipse, "(" );
 
-    //
-    // Function logging definitions.
-    //
-    
-    
-    #if defined(TRACE_FILE_LIMIT_SIZE)
-        #define FUNC( aMsg, aP1 )\
-        {\
-            _LIT8( KMsg, aMsg );TBuf8<CMAILLOGBUFFERSIZE> buf=KNullDesC8(); if ( KMsg().Size() < buf.MaxSize() ) { buf.Format( KMsg, aP1 ); }CmailLogger::Write( buf ); }
-    #endif
-    #if defined(TRACE_INTO_FILE) && !defined(TRACE_FILE_LIMIT_SIZE)
+    /**
+    * Function logging definitions.
+    */
+    #ifdef TRACE_INTO_FILE
+
         #define FUNC( aMsg, aP1 )\
             {\
             _LIT8( KMsg, aMsg ); RFileLogger::WriteFormat(  KEmailDir,  KEmailTraceFile, EFileLoggingModeAppend, KMsg, aP1 );\
-            }
-    #endif
-    #if !defined(TRACE_INTO_FILE) 
+            }\
+
+    #else//TRACE_INTO_FILE not defined
+
         #define FUNC( aMsg, aP1 )\
             {\
             RDebug::Printf( aMsg, aP1 );\
             }\
 
     #endif//TRACE_INTO_FILE
-    
+
     /**
     * Function trace helper class.
     */
@@ -299,18 +231,13 @@
                     {
                     iFunc.Set( iFunc.Left( iFunc.Find( KEllipse ) ) );
                     }
-                #if defined(TRACE_INTO_FILE) && !defined(TRACE_FILE_LIMIT_SIZE)
+                #ifdef TRACE_INTO_FILE
 
                     //"CMAIL" string is added in the beginning of every trace
                     //line for filtering purposes
                     FUNC( "CMAIL %S <", &iFunc );
-                #endif
-                #if defined(TRACE_INTO_FILE) && defined(TRACE_FILE_LIMIT_SIZE)
-                    TBuf8<CMAILLOGBUFFERSIZE> buf(iFunc);
-                    buf.Append(_L("<"));
-                    CmailLogger::Write( buf );
-                #endif
-                #if !defined(TRACE_INTO_FILE)
+
+                #else//TRACE_INTO_FILE notdefined
 
                     FUNC( "CMAIL %s <", iFunc.Ptr() );
 
@@ -318,23 +245,21 @@
                 }
             inline ~TFuncLog()
                 {
-                #if defined(TRACE_INTO_FILE) && !defined(TRACE_FILE_LIMIT_SIZE)
+                #ifdef TRACE_INTO_FILE
+
                     FUNC( "CMAIL %S >", &iFunc );
-                #endif
-                #if defined(TRACE_INTO_FILE) && defined(TRACE_FILE_LIMIT_SIZE)
-                    TBuf8<CMAILLOGBUFFERSIZE> buf(iFunc);
-                    buf.Append(_L(">"));
-                    CmailLogger::Write( buf );
-                #endif
-                #if !defined(TRACE_INTO_FILE)
+
+                #else//TRACE_INTO_FILE not defined
 
                     FUNC( "CMAIL %s >", iFunc.Ptr() );
+
                 #endif//TRACE_INTO_FILE
                 }
             TPtrC8 iFunc;
         };
 
     #define FUNC_LOG TFuncLog _fl( __PRETTY_FUNCTION__ );
+
 #else//FUNC_TRACE not defined
 
     #define FUNC_LOG
@@ -345,9 +270,9 @@
 // Timestamp trace macros
 //-----------------------------------------------------------------------------
 //
-#if defined(TIMESTAMP_TRAC)
+#ifdef TIMESTAMP_TRACE
 
-    #if defined(TRACE_INTO_FIL)
+    #ifdef TRACE_INTO_FILE
 
         #define TIMESTAMP( aCaption )\
             {\