datacommsserver/networkcontroller/src/NetConLog.cpp
changeset 0 dfb7c4ff071f
equal deleted inserted replaced
-1:000000000000 0:dfb7c4ff071f
       
     1 // Copyright (c) 2003-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 NetConLog.cpp
       
    18 */
       
    19 
       
    20 
       
    21 #if defined(_DEBUG)
       
    22 
       
    23 #include "NetConLog.h"
       
    24 
       
    25 void NetConLog::Printf(TRefByValue<const TDesC> aFmt,...)
       
    26 /**
       
    27 Write a mulitple argument list to the log, trapping and ignoring any leave
       
    28 */
       
    29 	{
       
    30 
       
    31 	VA_LIST list;
       
    32 	VA_START(list,aFmt);
       
    33 	RFileLogger::WriteFormat(KNetConLogFolder(),KNetConLogFile(),EFileLoggingModeAppend,aFmt,list);
       
    34 	}
       
    35 
       
    36 /*  The following two functions are commented out as they not currently used
       
    37 
       
    38 void NetConLog::Write(const TDesC& aDes)
       
    39 //
       
    40 // Write aDes to the log
       
    41 //
       
    42 	{
       
    43 	RFileLogger::Write(KNetConLogFolder(),KNetConLogFile(),EFileLoggingModeAppend,aDes);
       
    44 	}
       
    45 
       
    46 void NetConLog::HexDump(const TText* aHeader, const TText* aMargin, const TUint8* aPtr, TInt aLen, TInt aWidth)
       
    47 	{
       
    48 
       
    49 	TBuf<0x100> buf;
       
    50 	TInt i = 0;
       
    51 	const TText* p = aHeader;
       
    52 	while (aLen>0)
       
    53 		{
       
    54 		TInt n = aLen>aWidth ? aWidth : aLen;
       
    55 		if (p!=NULL)
       
    56 			{
       
    57 			_LIT(string1,"%s%04x : ");
       
    58 			buf.AppendFormat(string1, p, i);
       
    59 			}
       
    60 		TInt j;
       
    61 		_LIT(string2,"%02x ");
       
    62 		for (j=0; j<n; j++)
       
    63 			buf.AppendFormat(string2, aPtr[i+j]);
       
    64 		_LIT(string3,"   ");
       
    65 		while (j++<KNetConLogHexDumpWidth)
       
    66 			buf.Append(string3);
       
    67 		_LIT(string4," ");
       
    68 		buf.Append(string4);
       
    69 		_LIT(string5,"%c");
       
    70 		for (j=0; j<n; j++)
       
    71 			buf.AppendFormat(string5, aPtr[i+j]<32 || aPtr[i+j]>126 ? '.' : aPtr[i+j]);
       
    72 		buf.Append(KEndOfLine);
       
    73 		Write(buf);
       
    74 		buf.SetLength(0);
       
    75 		aLen -= n;
       
    76 		i += n;
       
    77 		p = aMargin;
       
    78 		}
       
    79 	}
       
    80 
       
    81 */
       
    82 
       
    83 #endif // defined(_DEBUG)
       
    84