natplugins/natptraversalcontroller/inc/nattraversallog.inl
changeset 0 1bce908db942
equal deleted inserted replaced
-1:000000000000 0:1bce908db942
       
     1 /*
       
     2 * Copyright (c) 2006-2007 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 "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: 
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 #include <e32base.h>
       
    20 #include <e32svr.h>
       
    21 #include <utf.h>
       
    22 
       
    23 inline void NATTraversalLog::Print(
       
    24     const TDesC16& aStr)
       
    25     {
       
    26     _LIT(KLogFormat, "NTC/%S");
       
    27     TBuf<256> str;
       
    28     str.Format(KLogFormat, &aStr);
       
    29     RDebug::Print(str);
       
    30     }
       
    31 
       
    32 inline void NATTraversalLog::Print(
       
    33     const TDesC16& aStr1,
       
    34     const TDesC8& aStr2)
       
    35     {
       
    36     _LIT(KLogFormat, "NTC/%S: %S");
       
    37     TBuf<100> str2;
       
    38     CnvUtfConverter::ConvertToUnicodeFromUtf8(str2, aStr2);
       
    39     TBuf<256> str;
       
    40     str.Format(KLogFormat, &aStr1, &str2);
       
    41     RDebug::Print(str);
       
    42     }
       
    43 
       
    44 inline void NATTraversalLog::Print(
       
    45     const TDesC16& aStr,
       
    46     TInt aValue)
       
    47     {
       
    48     _LIT(KLogFormat, "NTC/%S: %d");
       
    49     TBuf<256> str;
       
    50     str.Format(KLogFormat, &aStr, aValue);
       
    51     RDebug::Print(str);
       
    52     }
       
    53 
       
    54 inline void NATTraversalLog::Print(
       
    55     const TDesC16& aStr,
       
    56     const TInetAddr& aAddr)
       
    57     {
       
    58     _LIT(KLogFormat, "NTC/%S: %S port %d");
       
    59     const TInt KIPv6AddrMaxLen = 39;
       
    60     TBuf<KIPv6AddrMaxLen> addrBuf;
       
    61     aAddr.Output(addrBuf);
       
    62     TBuf<256> str;
       
    63     str.Format(KLogFormat, &aStr, &addrBuf, aAddr.Port());
       
    64     RDebug::Print(str);
       
    65     }