usbuis/usbuinotif/tsrc/usbuinotifapitest/inc/usbuinotifapitestdebug.inl
branchRCL_3
changeset 64 8ecef05bbada
child 46 0ffee699d6c7
equal deleted inserted replaced
8:7e15987c4500 64:8ecef05bbada
       
     1 /*
       
     2 * Copyright (c) 2008-2009 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 "Symbian Foundation License v1.0"
       
     6 * which accompanies this distribution, and is available
       
     7 * at the URL "http://www.symbianfoundation.org/legal/sfl-v10.html".
       
     8 *
       
     9 * Initial Contributors:
       
    10 * Nokia Corporation - initial contribution.
       
    11 *
       
    12 * Contributors:
       
    13 *
       
    14 * Description:  
       
    15 *
       
    16 */
       
    17 
       
    18 #include <e32debug.h>
       
    19 
       
    20 NONSHARABLE_CLASS(TOverflowTruncate8) : public TDes8Overflow
       
    21     {
       
    22 public:
       
    23     void Overflow(TDes8& /*aDes*/) {}
       
    24     }; 
       
    25 
       
    26 NONSHARABLE_CLASS(TOverflowTruncate16) : public TDes16Overflow
       
    27     {
       
    28 public:
       
    29     void Overflow(TDes16& /*aDes*/) {}
       
    30     };
       
    31 
       
    32 
       
    33 _LIT8(KStifTestPrefix8, "[STIF_LOG] ");
       
    34 _LIT(KStifTestPrefix, "[STIF_LOG] ");
       
    35 
       
    36 const TInt KMaxLogLineLength = 512;
       
    37 
       
    38 #define TRACE_INFO(p) { Trace p; }
       
    39 
       
    40 void CUsbUiNotifApiTest::Trace(TRefByValue<const TDesC8> aFmt, ...)
       
    41 	{
       
    42 	VA_LIST list;
       
    43 	VA_START(list, aFmt);
       
    44 	TOverflowTruncate8 overflow;        
       
    45 	RBuf8 buf8;
       
    46 	buf8.Create( KMaxLogLineLength );
       
    47 	buf8.Append( KStifTestPrefix8 );
       
    48 	buf8.AppendFormatList(aFmt, list, &overflow);
       
    49 			
       
    50 	RBuf16 buf16;
       
    51 	buf16.Create( KMaxLogLineLength );
       
    52 	buf16.Copy(buf8);    
       
    53 	TRefByValue<const TDesC> tmpFmt(_L("%S"));
       
    54 	RDebug::Print(tmpFmt, &buf16);
       
    55 	iLog->Log(tmpFmt, &buf16);
       
    56 	buf8.Close();         
       
    57 	buf16.Close();
       
    58 	};
       
    59 
       
    60 void CUsbUiNotifApiTest::Trace(TRefByValue<const TDesC16> aFmt, ...)
       
    61 	{
       
    62 	VA_LIST list;
       
    63 	VA_START(list,aFmt);
       
    64 	RBuf16 theFinalString;
       
    65 	theFinalString.Create( KMaxLogLineLength );
       
    66 	theFinalString.Append( KStifTestPrefix );
       
    67 	TOverflowTruncate16 overflow;
       
    68 	theFinalString.AppendFormatList(aFmt,list,&overflow);
       
    69 	RDebug::Print(theFinalString);
       
    70 	iLog->Log(theFinalString);
       
    71 	theFinalString.Close(); 
       
    72 	};