sl@0: // Copyright (c) 2003-2009 Nokia Corporation and/or its subsidiary(-ies). sl@0: // All rights reserved. sl@0: // This component and the accompanying materials are made available sl@0: // under the terms of "Eclipse Public License v1.0" sl@0: // which accompanies this distribution, and is available sl@0: // at the URL "http://www.eclipse.org/legal/epl-v10.html". sl@0: // sl@0: // Initial Contributors: sl@0: // Nokia Corporation - initial contribution. sl@0: // sl@0: // Contributors: sl@0: // sl@0: // Description: sl@0: // code that logs using RDebug::Print sl@0: // sl@0: // sl@0: sl@0: #include "DebLogRD.H" sl@0: sl@0: sl@0: EXPORT_C CDebugLogBase *CreateDebugLog(TBool aIsFirst, TDesC &aParams) sl@0: { sl@0: CDebugLogPrint *device=new(ELeave) CDebugLogPrint(); sl@0: CDebugLog *log=NULL; sl@0: TRAPD(err,log=new(ELeave) CDebugLog(device)); sl@0: if (err!=KErrNone) sl@0: { sl@0: delete device; sl@0: User::Leave(err); sl@0: } sl@0: TRAP(err,log->ConstructL(aIsFirst, aParams)); sl@0: if (err!=KErrNone) sl@0: { sl@0: delete log; sl@0: User::Leave(err); sl@0: } sl@0: return(log); sl@0: } sl@0: sl@0: CDebugLogPrint::CDebugLogPrint() sl@0: {} sl@0: sl@0: CDebugLogPrint::~CDebugLogPrint() sl@0: {} sl@0: sl@0: void CDebugLogPrint::ConstructL(TBool /*aIsFirst*/, TDesC& /*aParams*/) sl@0: {} sl@0: sl@0: void CDebugLogPrint::WriteToLogL(const TDesC &aDes, const TDesC &aDes2) sl@0: { sl@0: TBuf<256> buf; sl@0: TInt pos=aDes.LocateReverse(' '); sl@0: if (pos<0) sl@0: pos=0; sl@0: buf.Copy(aDes.Mid(pos)); sl@0: buf.Append(' '); sl@0: buf.Append(aDes2); sl@0: _LIT(KDebugFormatString, "%S"); sl@0: RDebug::Print(KDebugFormatString, &buf); sl@0: } sl@0: sl@0: void CDebugLogPrint::WriteToLog8L(const TDesC8 &aDes, const TDesC8 &aDes2) sl@0: { sl@0: TBuf16<256> buf; sl@0: TInt pos=aDes.LocateReverse(' '); sl@0: if (pos<0) sl@0: pos=0; sl@0: buf.Copy(aDes.Mid(pos)); sl@0: buf.Append(' '); sl@0: TInt bufLen=buf.Length(); sl@0: TPtr16 ptr(&buf[bufLen],buf.MaxLength()-bufLen); sl@0: ptr.Copy(aDes2); sl@0: buf.SetLength(bufLen+aDes2.Length()); sl@0: _LIT(KDebugFormatString, "%S"); sl@0: RDebug::Print(KDebugFormatString, &buf); sl@0: } sl@0: