telephonyserverplugins/ctsydispatchlayer/src/ltsylogger.cpp
author Pat Downey <patd@symbian.org>
Tue, 13 Jul 2010 14:53:59 +0100
branchRCL_3
changeset 50 2ac16fe2d995
parent 0 3553901f7fa8
child 24 6638e7f4bd8f
child 42 3adadc800673
permissions -rw-r--r--
Re-merge addition of wapstack to fid bug 1398.

// Copyright (c) 2008-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:
// Logging macros for Tsy. These use the Comms Debug / Flogger V2
// Framework.
//



/**
 @file
 @internalComponent
*/

#include <ctsy/ltsy/ltsylogger.h>

#ifdef _DEBUG
#include <e32debug.h>
#include <comms-infras/commsdebugutility.h>

const TInt KLineLength = 255;

EXPORT_C TLogEntryExit::TLogEntryExit(const TDesC8& aFnName, const TDesC8& aLayer)
/**
Constructor: log the function name entry
*/
	:iFnName(aFnName), iLayer(aLayer), iErr(KErrNone)
	{
	RFileLogger::WriteFormat(KTsySubSystem, iLayer, _L8(">>%S"), &iFnName);
	};

EXPORT_C TLogEntryExit::TLogEntryExit(const TDesC8& aFnName, const TDesC8& aLayer, TRefByValue<const TDesC8> aFmt, ...)
/**
Write the function name entry plus plus 8 bits formated list
*/
	:iFnName(aFnName), iLayer(aLayer), iErr(KErrNone)
	{
	VA_LIST list;
	VA_START(list,aFmt);
	TBuf8<KLineLength> line;
	line.Append(_L8(">>"));
	line.Append(iFnName);
	line.Append(' ');
	line.Append(aFmt);
	RFileLogger::WriteFormat(KTsySubSystem, iLayer, line, list);
	};

EXPORT_C TLogEntryExit::TLogEntryExit(const TDesC8& aFnName, const TDesC8& aLayer, TRefByValue<const TDesC16> aFmt, ...)
/**
Write the function name entry plus 16 bits formated list
*/
	:iFnName(aFnName), iLayer(aLayer), iErr(KErrNone)
	{
	VA_LIST list;
	VA_START(list,aFmt);

	TBuf<KLineLength> line;
	line.Copy(iFnName);
	line.Insert(0,_L(">>"));
	line.Append(' ');
	line.Append(aFmt);
	RFileLogger::WriteFormat(KTsySubSystem, iLayer, line, list);
	};
			
EXPORT_C TLogEntryExit::~TLogEntryExit()
/**
Write the function name exit
*/
	{
	if (iErr == KErrNone)
		{
		RFileLogger::WriteFormat(KTsySubSystem, iLayer, _L8("<<%S"), &iFnName);
		}
	else
		{
		RFileLogger::WriteFormat(KTsySubSystem, iLayer, _L8("<<%S [err=%d]"), &iFnName, iErr);
		}
	};

#else // #ifdef _DEBUG

// stub export for urel builds
EXPORT_C TLogEntryExit::TLogEntryExit(const TDesC8& /*aFnName*/, const TDesC8& /*aLayer*/){};
EXPORT_C TLogEntryExit::TLogEntryExit(const TDesC8& /*aFnName*/, const TDesC8& /*aLayer*/, TRefByValue<const TDesC8> /*aFmt*/, ...){};
EXPORT_C TLogEntryExit::TLogEntryExit(const TDesC8& /*aFnName*/, const TDesC8& /*aLayer*/, TRefByValue<const TDesC16> /*aFmt*/, ...){};
EXPORT_C TLogEntryExit::~TLogEntryExit() {};

#endif // #ifdef _DEBUG