diff -r 000000000000 -r af10295192d8 networksecurity/tls/protocol/LOGFILE.CPP --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/networksecurity/tls/protocol/LOGFILE.CPP Tue Jan 26 15:23:49 2010 +0200 @@ -0,0 +1,73 @@ +// Copyright (c) 1997-2009 Nokia Corporation and/or its subsidiary(-ies). +// All rights reserved. +// This component and the accompanying materials are made available +// under the terms of "Eclipse Public License v1.0" +// which accompanies this distribution, and is available +// at the URL "http://www.eclipse.org/legal/epl-v10.html". +// +// Initial Contributors: +// Nokia Corporation - initial contribution. +// +// Contributors: +// +// Description: +// + +#include +#include +#include "LOGFILE.H" + +#ifdef __TRACEFILE__ + +const TInt KHexDumpWidth = 16; + + + +void Log::Write(const TDesC& aDes) + { + RFileLogger::Write(KSSLLogDir,KSSLLogFileName,EFileLoggingModeAppend,aDes); + } + + +void Log::Printf(TRefByValue aFmt, ...) + { + //coverity[var_decl]; + VA_LIST list; + VA_START(list, aFmt); + TBuf<0x100> buf; + //coverity[uninit_use_in_call]; + buf.FormatList(aFmt, list); + Write(buf); + } + + +void Log::HexDump(const TText* aHeader, const TText* aMargin, const TUint8* aPtr, TInt aLen) + { + + TBuf<0x100> buf; + buf.SetLength(0); + TInt i = 0; + const TText* p = aHeader; + while (aLen>0) + { + TInt n = aLen>KHexDumpWidth ? KHexDumpWidth : aLen; + buf.AppendFormat(_L("%s%04x : "), p, i); + TInt j; + for (j=0; j126 ? '.' : aPtr[i+j]); + buf.AppendFormat(_L("\r\n")); + Log::Write(buf); + buf.SetLength(0); + aLen -= n; + i += n; + p = aMargin; + } + } + + +#endif // __TRACEFILE__