tcpiputils/networkaddressandporttranslation/inc/naptlog.h
changeset 0 af10295192d8
equal deleted inserted replaced
-1:000000000000 0:af10295192d8
       
     1 // Copyright (c) 2007-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 
       
    18  @internalComponent
       
    19  @prototype
       
    20 */
       
    21 
       
    22 #if !defined(__NAPTLOG_H__)
       
    23 #define __NAPTLOG_H__
       
    24 
       
    25 #if !defined(_DEBUG) 
       
    26 #  define LOG(a)
       
    27 #else
       
    28 #  define LOG(a) a 
       
    29 #  define _LOG
       
    30 
       
    31 
       
    32 #include <comms-infras/commsdebugutility.h>
       
    33 
       
    34 _LIT(KNAPTLogFolder,"napt");
       
    35 _LIT(KNAPTLogFile,"napt.txt");  
       
    36 
       
    37 class Log
       
    38 	{
       
    39 public:
       
    40 	static inline void Write(const TDesC& aDes);
       
    41 	static inline void Printf(TRefByValue<const TDesC> aFmt, ...);
       
    42 	static inline void Printf(TRefByValue<const TDesC8> aFmt, ...);
       
    43 	static inline void HexDump(const TText* aHeader, const TText* aMargin, const TUint8* aPtr, TInt aLen);
       
    44 	};
       
    45 
       
    46 inline void Log::Write(const TDesC& aDes)
       
    47 {
       
    48 	RFileLogger::Write(KNAPTLogFolder(), KNAPTLogFile(), EFileLoggingModeAppend, aDes);
       
    49 }
       
    50 	
       
    51 
       
    52 inline void Log::Printf(TRefByValue<const TDesC> aFmt, ...)
       
    53 {
       
    54 	VA_LIST list;
       
    55 	VA_START(list,aFmt);
       
    56 	RFileLogger::WriteFormat(KNAPTLogFolder(), KNAPTLogFile(), EFileLoggingModeAppend, aFmt, list);
       
    57 }
       
    58 
       
    59 inline void Log::Printf(TRefByValue<const TDesC8> aFmt, ...)
       
    60 {
       
    61 	VA_LIST list;
       
    62 	VA_START(list,aFmt);
       
    63 	RFileLogger::WriteFormat(KNAPTLogFolder(), KNAPTLogFile(), EFileLoggingModeAppend, aFmt, list);
       
    64 }
       
    65 
       
    66 inline void Log::HexDump(const TText* aHeader, const TText* aMargin, const TUint8* aPtr, TInt aLen)
       
    67 {
       
    68 	RFileLogger::HexDump(KNAPTLogFolder(), KNAPTLogFile(), EFileLoggingModeAppend, aHeader, aMargin, aPtr, aLen);
       
    69 }
       
    70 
       
    71 #endif // 
       
    72 #endif //__NAPTLOG_H__
       
    73