browserutilities/connectionmanager/Inc/ConnectionManagerLogger.h
changeset 0 dd21522fd290
equal deleted inserted replaced
-1:000000000000 0:dd21522fd290
       
     1 /*
       
     2 * Copyright (c) 2002-2004 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 the License "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:  ?Description
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 #ifndef HTTPDOWNLOADMGRLOGGER_H
       
    20 #define HTTPDOWNLOADMGRLOGGER_H
       
    21 
       
    22 // INCLUDE FILES
       
    23 #include <e32svr.h>
       
    24 
       
    25 #ifdef _DEBUG
       
    26 
       
    27 #define __DOWNLOADMGR_LOG__
       
    28 #include <flogger.h>
       
    29 
       
    30 // CONSTANTS
       
    31 
       
    32 class CFunctionEntryExit;
       
    33 
       
    34 //Logging to file in THUMB UDEB
       
    35 NONSHARABLE_CLASS( TDMLogger )
       
    36 	{
       
    37     public: // methods
       
    38 
       
    39         static void CreateFlogger( TAny* aOwner );
       
    40         static void CloseFLogger( TAny* aOwner );
       
    41 
       
    42         static void AttachFLogger( const TAny* aOwner, 
       
    43                                    const TAny* aAttach1,
       
    44                                    const TAny* aAttach2 );
       
    45        
       
    46         static void NameIt( const TAny* aOwner, 
       
    47                             TRefByValue<const TDesC> aNameFmt, ...);
       
    48         
       
    49 	    static void LogIt(const TAny* aOwner, TRefByValue<const TDesC> aFmt, ...);
       
    50         static void LogIt(const TAny* aOwner, TRefByValue<const TDesC8> aFmt, ...);
       
    51 	    static void LogIt(const TAny* aOwner, TRefByValue<const TDesC> aFmt, VA_LIST aList );
       
    52         static void LogIt(const TAny* aOwner, TRefByValue<const TDesC8> aFmt, VA_LIST aList );
       
    53 
       
    54 	    static void WriteComment(const TAny* aOwner, const TDesC& aComment);
       
    55 	    static void WriteComment(const TAny* aOwner, const TDesC8& aData);
       
    56 
       
    57 	    static void DumpIt(const TAny* aOwner, const TDesC8& aData);
       
    58 
       
    59     private:       
       
    60 
       
    61         TBuf<2048>      iLogBuf;
       
    62         TBuf8<2048>     iLogBuf8;
       
    63         TInt            iRefCounter;
       
    64 	};
       
    65 
       
    66 NONSHARABLE_CLASS( CFunctionEntryExit )
       
    67     {
       
    68     public:
       
    69 
       
    70         CFunctionEntryExit( const TAny* aOwner, TRefByValue<const TDesC> aFunc );
       
    71         ~CFunctionEntryExit();
       
    72 
       
    73     public:
       
    74     
       
    75         HBufC*      iFunc;
       
    76         const TAny* iOwner;
       
    77     };
       
    78 
       
    79 #define _T8( a )                            TPtrC8( (const TText8*)(a) )
       
    80 #define CLOG_ENTERFN( a )                   CFunctionEntryExit entryExit( this, _L(a) );
       
    81 #define CLOG_ENTERFN_NULL( a )              CFunctionEntryExit entryExit( NULL, _L(a) );
       
    82 
       
    83 #define CLOG_CREATE                      TDMLogger::CreateFlogger( this );
       
    84 #define CLOG_CREATE_NULL                 TDMLogger::CreateFlogger( NULL );
       
    85 #define CLOG_ATTACH( attach1, attach2 )  TDMLogger::AttachFLogger( this, attach1, attach2 );
       
    86 #define CLOG_NAME( a )                   TDMLogger::NameIt( this, a );
       
    87 #define CLOG_NAME_1( a, b )             TDMLogger::NameIt( this, a, b );
       
    88 #define CLOG_NAME_2( a, b, c )          TDMLogger::NameIt( this, a, b, c );
       
    89 #define CLOG_NAME_3( a, b, c, d )       TDMLogger::NameIt( this, a, b, c, d );
       
    90 #define CLOG_CLOSE                          TDMLogger::CloseFLogger( this );
       
    91 #define CLOG_WRITE( a )                     TDMLogger::LogIt( this, _L(a) );
       
    92 #define CLOG_WRITE_FORMAT( a, b )           TDMLogger::LogIt( this, _L(a), b );
       
    93 #define CLOG_WRITE_1( a, b )                TDMLogger::LogIt( this, _L(a), b );
       
    94 #define CLOG_WRITE_2( a, b, c )             TDMLogger::LogIt( this, _L(a), b, c );
       
    95 #define CLOG_WRITE_3( a, b, c, d )          TDMLogger::LogIt( this, _L(a), b, c, d );
       
    96 #define CLOG_WRITE_4( a, b, c, d, e )       TDMLogger::LogIt( this, _L(a), b, c, d, e );
       
    97 #define CLOG_WRITE8( a )                    TDMLogger::LogIt( this, _T8(a) );
       
    98 #define CLOG_WRITE8_1( a, b )               TDMLogger::LogIt( this, _T8(a), b );
       
    99 #define CLOG_WRITE8_2( a, b, c )            TDMLogger::LogIt( this, _T8(a), b, c );
       
   100 #define CLOG_WRITE8_3( a, b, c, d )         TDMLogger::LogIt( this, _T8(a), b, c, d );
       
   101 #define CLOG_WRITE8_4( a, b, c, d, e )      TDMLogger::LogIt( this, _T8(a), b, c, d, e );
       
   102 
       
   103 #define CLOG_ATTACH_NULL( attach1, attach2 )    TDMLogger::AttachFLogger( NULL, attach1, attach2 );
       
   104 #define CLOG_WRITE_NULL( a )                    TDMLogger::LogIt( NULL, _L(a) );
       
   105 #define CLOG_WRITE_1_NULL( a, b )               TDMLogger::LogIt( NULL, _L(a), b );
       
   106 #define CLOG_WRITE_FORMAT_NULL( a, b )          TDMLogger::LogIt( NULL, _L(a), b );
       
   107 #define CLOG_CLOSE_NULL                         TDMLogger::CloseFLogger( NULL );
       
   108 
       
   109 #else   // _DEBUG
       
   110 
       
   111 #define CLOG_ENTERFN( a )
       
   112 #define CLOG_ENTERFN_NULL( a )
       
   113 
       
   114 #define CLOG_CREATE
       
   115 #define CLOG_CREATE_NULL
       
   116 #define CLOG_ATTACH( attach1, attach2 )
       
   117 #define CLOG_NAME( a )
       
   118 #define CLOG_NAME_1( a, b )
       
   119 #define CLOG_NAME_2( a, b, c )
       
   120 #define CLOG_NAME_3( a, b, c, d )
       
   121 #define CLOG_CLOSE
       
   122 #define CLOG_WRITE( a )
       
   123 #define CLOG_WRITE_FORMAT( a, b )
       
   124 #define CLOG_WRITE_1( a, b )
       
   125 #define CLOG_WRITE_2( a, b, c )
       
   126 #define CLOG_WRITE_3( a, b, c, d )
       
   127 #define CLOG_WRITE_4( a, b, c, d, e )
       
   128 #define CLOG_WRITE8( a )
       
   129 #define CLOG_WRITE8_1( a, b )
       
   130 #define CLOG_WRITE8_2( a, b, c )
       
   131 #define CLOG_WRITE8_3( a, b, c, d )
       
   132 #define CLOG_WRITE8_4( a, b, c, d, e )
       
   133 
       
   134 #define CLOG_ATTACH_NULL( attach1, attach2 )
       
   135 #define CLOG_WRITE_NULL( a )
       
   136 #define CLOG_WRITE_1_NULL( a, b )
       
   137 #define CLOG_WRITE_FORMAT_NULL( a, b )
       
   138 #define CLOG_CLOSE_NULL
       
   139 
       
   140 #endif // _DEBUG
       
   141 #endif	// HTTPDOWNLOADMGRLOGGER_H
       
   142 
       
   143 // End of file