usbengines/usbotgwatcher/tsrc/UsbOtgWatcherTest/inc/testdebug.inl
branchRCL_3
changeset 92 dde4619868dc
parent 86 703a2b94c06c
child 95 55a3258355ea
equal deleted inserted replaced
86:703a2b94c06c 92:dde4619868dc
     1 /*
       
     2 * Copyright (c) 2010 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 #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 TLogBuf16 TTestLogger::CreateLogBuf( TRefByValue<const TDesC8> aFmt, ... )
       
    33     {
       
    34     VA_LIST list;
       
    35     VA_START( list, aFmt );
       
    36     TOverflowTruncate8 overflow;   
       
    37     TLogBuf8 buf8;
       
    38     TLogBuf16 buf16;
       
    39     buf8.AppendFormatList( aFmt, list, &overflow );
       
    40     buf16.Copy( buf8 );
       
    41     return buf16;
       
    42     };
       
    43 
       
    44 TLogBuf16 TTestLogger::CreateLogBuf( TRefByValue<const TDesC16> aFmt, ... )
       
    45     {
       
    46     VA_LIST list;
       
    47     VA_START( list, aFmt );
       
    48     TOverflowTruncate16 overflow;
       
    49     TLogBuf16 buf16;
       
    50     buf16.AppendFormatList( aFmt, list, &overflow );
       
    51     return buf16;
       
    52     };
       
    53 
       
    54 void TTestLogger::Trace( CStifLogger& aLog, TLogBuf16 aLogBuf )
       
    55     {    
       
    56     RBuf16 buf;
       
    57     RBuf16 bufStifLog;
       
    58     
       
    59     buf.Create( KMaxLogLineLength );
       
    60     buf.Append( KStifTestPrefix );
       
    61     buf.Append( aLogBuf );
       
    62     bufStifLog.Create( KMaxLogLineLength );
       
    63     bufStifLog.Append( aLogBuf );
       
    64     
       
    65     RDebug::Print( buf );
       
    66     aLog.Log( bufStifLog );
       
    67     buf.Close();
       
    68     bufStifLog.Close();
       
    69     };