networksecurity/ipsec/cscommon/inc/logcommon.h
changeset 0 af10295192d8
equal deleted inserted replaced
-1:000000000000 0:af10295192d8
       
     1 // Copyright (c) 2004-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 
       
    18 /**
       
    19  @internalComponent
       
    20 */
       
    21 
       
    22 #if !defined(__LOGCOMMON_H__)
       
    23 #define __LOGCOMMON_H__
       
    24 
       
    25 #if !defined(__FLOG_ACTIVE)
       
    26 #  define LOG(a)
       
    27 #else 
       
    28 #  define LOG(a) a 
       
    29 #  define _LOG
       
    30 
       
    31 __FLOG_STMT(_LIT8(KLogSubSys, "Ipsec");) // subsystem name
       
    32 
       
    33 class Log
       
    34 	{
       
    35 public:
       
    36 	static inline void Write(const TDesC& aDes);
       
    37 	static inline void Printf(TRefByValue<const TDesC> aFmt, ...);
       
    38 	static inline void Printf(TRefByValue<const TDesC8> aFmt, ...);
       
    39 	static inline void HexDump(const TText* aHeader, const TText* aMargin, const TUint8* aPtr, TInt aLen);
       
    40 	};
       
    41 
       
    42 inline void Log::Write(const TDesC& aDes)
       
    43 {
       
    44 	__FLOG_DECLARATION_VARIABLE;
       
    45 	__FLOG_OPEN(KLogSubSys,KLogComponent);
       
    46 	__FLOG_VA((aDes));
       
    47 	__FLOG_CLOSE;
       
    48 }
       
    49 
       
    50 inline void Log::Printf(TRefByValue<const TDesC> aFmt, ...)
       
    51 {
       
    52 __FLOG_DECLARATION_VARIABLE;
       
    53 __FLOG_OPEN(KLogSubSys,KLogComponent);
       
    54 __FLOG_VA((aFmt));
       
    55 __FLOG_CLOSE;
       
    56 } 
       
    57 
       
    58 inline void Log::Printf(TRefByValue<const TDesC8> aFmt, ...)
       
    59 {
       
    60 __FLOG_DECLARATION_VARIABLE;
       
    61 __FLOG_OPEN(KLogSubSys,KLogComponent);
       
    62 __FLOG_VA((aFmt));
       
    63 __FLOG_CLOSE;
       
    64 }
       
    65 
       
    66 inline void Log::HexDump(const TText* aHeader, const TText* aMargin, const TUint8* aPtr, TInt aLen)
       
    67 {
       
    68 __FLOG_DECLARATION_VARIABLE;
       
    69 __FLOG_OPEN(KLogSubSys,KLogComponent);
       
    70 __FLOG_HEXDUMP((aHeader,aMargin,aPtr,aLen));
       
    71 __FLOG_CLOSE;
       
    72 }
       
    73 
       
    74 #endif // !defined(_FLOG_ACTIVE) || EPOC_SDK < 0x06000000
       
    75 
       
    76 #endif //__LOGCOMMON_H__