1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
1.2 +++ b/os/graphics/windowing/windowserver/debuglog/DebLogRD.CPP Fri Jun 15 03:10:57 2012 +0200
1.3 @@ -0,0 +1,77 @@
1.4 +// Copyright (c) 2003-2009 Nokia Corporation and/or its subsidiary(-ies).
1.5 +// All rights reserved.
1.6 +// This component and the accompanying materials are made available
1.7 +// under the terms of "Eclipse Public License v1.0"
1.8 +// which accompanies this distribution, and is available
1.9 +// at the URL "http://www.eclipse.org/legal/epl-v10.html".
1.10 +//
1.11 +// Initial Contributors:
1.12 +// Nokia Corporation - initial contribution.
1.13 +//
1.14 +// Contributors:
1.15 +//
1.16 +// Description:
1.17 +// code that logs using RDebug::Print
1.18 +//
1.19 +//
1.20 +
1.21 +#include "DebLogRD.H"
1.22 +
1.23 +
1.24 +EXPORT_C CDebugLogBase *CreateDebugLog(TBool aIsFirst, TDesC &aParams)
1.25 + {
1.26 + CDebugLogPrint *device=new(ELeave) CDebugLogPrint();
1.27 + CDebugLog *log=NULL;
1.28 + TRAPD(err,log=new(ELeave) CDebugLog(device));
1.29 + if (err!=KErrNone)
1.30 + {
1.31 + delete device;
1.32 + User::Leave(err);
1.33 + }
1.34 + TRAP(err,log->ConstructL(aIsFirst, aParams));
1.35 + if (err!=KErrNone)
1.36 + {
1.37 + delete log;
1.38 + User::Leave(err);
1.39 + }
1.40 + return(log);
1.41 + }
1.42 +
1.43 +CDebugLogPrint::CDebugLogPrint()
1.44 + {}
1.45 +
1.46 +CDebugLogPrint::~CDebugLogPrint()
1.47 + {}
1.48 +
1.49 +void CDebugLogPrint::ConstructL(TBool /*aIsFirst*/, TDesC& /*aParams*/)
1.50 + {}
1.51 +
1.52 +void CDebugLogPrint::WriteToLogL(const TDesC &aDes, const TDesC &aDes2)
1.53 + {
1.54 + TBuf<256> buf;
1.55 + TInt pos=aDes.LocateReverse(' ');
1.56 + if (pos<0)
1.57 + pos=0;
1.58 + buf.Copy(aDes.Mid(pos));
1.59 + buf.Append(' ');
1.60 + buf.Append(aDes2);
1.61 + _LIT(KDebugFormatString, "%S");
1.62 + RDebug::Print(KDebugFormatString, &buf);
1.63 + }
1.64 +
1.65 +void CDebugLogPrint::WriteToLog8L(const TDesC8 &aDes, const TDesC8 &aDes2)
1.66 + {
1.67 + TBuf16<256> buf;
1.68 + TInt pos=aDes.LocateReverse(' ');
1.69 + if (pos<0)
1.70 + pos=0;
1.71 + buf.Copy(aDes.Mid(pos));
1.72 + buf.Append(' ');
1.73 + TInt bufLen=buf.Length();
1.74 + TPtr16 ptr(&buf[bufLen],buf.MaxLength()-bufLen);
1.75 + ptr.Copy(aDes2);
1.76 + buf.SetLength(bufLen+aDes2.Length());
1.77 + _LIT(KDebugFormatString, "%S");
1.78 + RDebug::Print(KDebugFormatString, &buf);
1.79 + }
1.80 +