browserutilities/downloadmgr/DownloadMgrServEng/Inc/HttpDownloadMgrLogger.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 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 class CFunctionEntryExit : public CBase
       
    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 LOGGER_ENTERFN( a )       CFunctionEntryExit entryExit( this, _L(a) )
       
    81 
       
    82 #define CLOG_CREATE                      TDMLogger::CreateFlogger( this )
       
    83 #define CLOG_CREATE_NULL                 TDMLogger::CreateFlogger( NULL )
       
    84 #define CLOG_ATTACH( attach1, attach2 )  TDMLogger::AttachFLogger( this, attach1, attach2 )
       
    85 #define CLOG_NAME( a )                   TDMLogger::NameIt( this, a )
       
    86 #define CLOG_NAME_1( a, b )             TDMLogger::NameIt( this, a, b )
       
    87 #define CLOG_NAME_2( a, b, c )          TDMLogger::NameIt( this, a, b, c )
       
    88 #define CLOG_NAME_3( a, b, c, d )       TDMLogger::NameIt( this, a, b, c, d )
       
    89 #define CLOG_CLOSE                      TDMLogger::CloseFLogger( this )
       
    90 #define CLOG_WRITE( a )                   TDMLogger::LogIt( this, _L(a) )
       
    91 #define CLOG_WRITE_1( a, b )              TDMLogger::LogIt( this, _L(a), b )
       
    92 #define CLOG_WRITE_2( a, b, c )           TDMLogger::LogIt( this, _L(a), b, c )
       
    93 #define CLOG_WRITE_3( a, b, c, d )        TDMLogger::LogIt( this, _L(a), b, c, d )
       
    94 #define CLOG_WRITE_4( a, b, c, d, e )     TDMLogger::LogIt( this, _L(a), b, c, d, e )
       
    95 #define CLOG_WRITE8( a )                  TDMLogger::LogIt( this, _T8(a) )
       
    96 #define CLOG_WRITE8_1( a, b )             TDMLogger::LogIt( this, _T8(a), b )
       
    97 #define CLOG_WRITE8_2( a, b, c )          TDMLogger::LogIt( this, _T8(a), b, c )
       
    98 #define CLOG_WRITE8_3( a, b, c, d )       TDMLogger::LogIt( this, _T8(a), b, c, d )
       
    99 #define CLOG_WRITE8_4( a, b, c, d, e )    TDMLogger::LogIt( this, _T8(a), b, c, d, e )
       
   100 
       
   101 #else   // _DEBUG
       
   102 
       
   103 #define LOGGER_ENTERFN( a )
       
   104 #define CLOG_CREATE                
       
   105 #define CLOG_ATTACH( attach1, attach2 )
       
   106 #define CLOG_NAME( a )
       
   107 #define CLOG_NAME_1( a, b )
       
   108 #define CLOG_NAME_2( a, b, c )
       
   109 #define CLOG_NAME_3( a, b, c, d )
       
   110 #define CLOG_CLOSE
       
   111 #define CLOG_WRITE( a )                   
       
   112 #define CLOG_WRITE_1( a, b )              
       
   113 #define CLOG_WRITE_2( a, b, c )           
       
   114 #define CLOG_WRITE_3( a, b, c, d )        
       
   115 #define CLOG_WRITE_4( a, b, c, d, e )     
       
   116 #define CLOG_WRITE8( a )                  
       
   117 #define CLOG_WRITE8_1( a, b )             
       
   118 #define CLOG_WRITE8_2( a, b, c )          
       
   119 #define CLOG_WRITE8_3( a, b, c, d )       
       
   120 #define CLOG_WRITE8_4( a, b, c, d, e )    
       
   121 
       
   122 #endif // _DEBUG
       
   123 #endif	// HTTPDOWNLOADMGRLOGGER_H
       
   124 
       
   125 // End of file