applayerprotocols/httpexamples/nwsswsptrhnd/logging.h
changeset 0 b16258d2340f
equal deleted inserted replaced
-1:000000000000 0:b16258d2340f
       
     1 // Copyright (c) 2001-2009 Nokia Corporation and/or its subsidiary(-ies).
       
     2 // All rights reserved.
       
     3 // This component and the accompanying materials are made available
       
     4 // under the terms of "Eclipse Public License v1.0"
       
     5 // which accompanies this distribution, and is available
       
     6 // at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
     7 //
       
     8 // Initial Contributors:
       
     9 // Nokia Corporation - initial contribution.
       
    10 //
       
    11 // Contributors:
       
    12 //
       
    13 // Description:
       
    14 //
       
    15 
       
    16 /**
       
    17  @file logging.h
       
    18  @warning : This file contains Rose Model ID comments - please do not delete
       
    19 */
       
    20 
       
    21 #ifndef __LOGGING_H__
       
    22 #define __LOGGING_H__
       
    23 
       
    24 // System includes
       
    25 #include <e32std.h>
       
    26 #include <f32file.h>
       
    27 #include <flogger.h>
       
    28 
       
    29 // By default, logging will always be switched on.  Later, this may be removed, leaving it to individual
       
    30 // source files to enable logging where needed.
       
    31 #define _LOGGING
       
    32 
       
    33 #if defined (_DEBUG) && defined (_LOGGING)
       
    34 
       
    35 // HTTP Logging macros
       
    36 #define __DECLARE_LOG		RFileLogger iLogger;
       
    37 #define __OPENLOG(D, L)		iLogger.Connect(); \
       
    38 							TParse p; \
       
    39 							_LIT(KLogFile, L); \
       
    40 							p.Set(KLogFile(), NULL, NULL); \
       
    41 							_LIT(KLogDir, D); \
       
    42 							iLogger.CreateLog(KLogDir(), p.NameAndExt(), EFileLoggingModeOverwrite); \
       
    43 							iLogger.SetDateAndTime(ETrue, ETrue);
       
    44 #define __LOG_TITLE(T)		iLogger.Write(TPtrC8((const TText8 *)(T)));
       
    45 #define __CLOSELOG			iLogger.Close();
       
    46 #define __LOG(C)			iLogger.Write(TPtrC8((const TText8 *)(C)));
       
    47 #define __LOG1(C, X)		iLogger.WriteFormat(TPtrC8((const TText8 *)(C)), X);
       
    48 #define __LOG2(C, X, Y)		iLogger.WriteFormat(TPtrC8((const TText8 *)(C)), X, Y);
       
    49 #define __LOG3(C, X, Y, Z)	iLogger.WriteFormat(TPtrC8((const TText8 *)(C)), X, Y, Z);
       
    50 #define __DUMP(H, M, D)		{_LIT(KHeader, H); \
       
    51 							_LIT(KMargin, M); \
       
    52 							iLogger.HexDump((const TText*)(KHeader().Ptr()), (const TText*)(KMargin().Ptr()), D.Ptr(), D.Length());}
       
    53 #define __QINFO(aText)		{User::InfoPrint(aText); User::After(1000000);} 
       
    54 
       
    55 #elif !defined (_DEBUG)
       
    56 
       
    57 // NULL macros
       
    58 #define __DECLARE_LOG		TUint8 iDummyLoggerNotUsed[sizeof(RFileLogger)];
       
    59 #define __OPENLOG(D, L)
       
    60 #define __LOG_TITLE(T)
       
    61 #define __CLOSELOG
       
    62 #define __LOG(C)			
       
    63 #define __LOG1(C, X)		
       
    64 #define __LOG2(C, X, Y)		
       
    65 #define __LOG3(C, X, Y, Z)	
       
    66 #define __DUMP(H, M, D)		
       
    67 #define __QINFO(aText) 
       
    68 #endif // !_DEBUG
       
    69 
       
    70 #endif // __LOGGING_H__