equal
deleted
inserted
replaced
1 // Copyright (c) 1997-2009 Nokia Corporation and/or its subsidiary(-ies). |
1 // Copyright (c) 1997-2010 Nokia Corporation and/or its subsidiary(-ies). |
2 // All rights reserved. |
2 // All rights reserved. |
3 // This component and the accompanying materials are made available |
3 // This component and the accompanying materials are made available |
4 // under the terms of "Eclipse Public License v1.0" |
4 // under the terms of "Eclipse Public License v1.0" |
5 // which accompanies this distribution, and is available |
5 // which accompanies this distribution, and is available |
6 // at the URL "http://www.eclipse.org/legal/epl-v10.html". |
6 // at the URL "http://www.eclipse.org/legal/epl-v10.html". |
421 logger.iLogFile.Set(aDir,aName,aMode); |
421 logger.iLogFile.Set(aDir,aName,aMode); |
422 // TBuf8<KLogBufferSize> buf; |
422 // TBuf8<KLogBufferSize> buf; |
423 TBuf8<1600> buf; //Want at least an mtu sized buffer |
423 TBuf8<1600> buf; //Want at least an mtu sized buffer |
424 //PG 14/08/2002 - If mode is set to *Raw, Don't change format of client buffer |
424 //PG 14/08/2002 - If mode is set to *Raw, Don't change format of client buffer |
425 if(aMode == EFileLoggingModeAppendRaw || aMode == EFileLoggingModeOverwriteRaw) |
425 if(aMode == EFileLoggingModeAppendRaw || aMode == EFileLoggingModeOverwriteRaw) |
426 buf.Copy(aText); |
426 { |
|
427 TPtrC8 ptr8; |
|
428 if (logger.LogSTI()) |
|
429 { |
|
430 ptr8.Set(aText.Left(KLogBufferSize)); //in LogSTI mode, truncate to KLogBufferSize |
|
431 } |
|
432 else |
|
433 { |
|
434 ptr8.Set(aText.Left(1600)); // truncate to 1600 |
|
435 } |
|
436 buf.Copy(ptr8); |
|
437 } |
427 else |
438 else |
|
439 { |
428 ret=logger.iFormatter.FormatTextToWritableBuffer(buf,aText); |
440 ret=logger.iFormatter.FormatTextToWritableBuffer(buf,aText); |
|
441 } |
429 if (ret==KErrNone) |
442 if (ret==KErrNone) |
|
443 { |
430 logger.DoStaticWrite(buf); |
444 logger.DoStaticWrite(buf); |
|
445 } |
431 } |
446 } |
432 logger.Close(); |
447 logger.Close(); |
433 } |
448 } |
434 |
449 |
435 EXPORT_C void RFileLogger::WriteFormat(const TDesC& aDir, const TDesC& aName, TFileLoggingMode aMode, TRefByValue<const TDesC8> aFmt,...) |
450 EXPORT_C void RFileLogger::WriteFormat(const TDesC& aDir, const TDesC& aName, TFileLoggingMode aMode, TRefByValue<const TDesC8> aFmt,...) |
595 { |
610 { |
596 TBuf<KLogBufferSize> n; |
611 TBuf<KLogBufferSize> n; |
597 n.Copy(aBuf); |
612 n.Copy(aBuf); |
598 TFileName logFileName = iLogFile.Name(); |
613 TFileName logFileName = iLogFile.Name(); |
599 RDebug::Print(_L("FLG %S %S"),&logFileName,&n); |
614 RDebug::Print(_L("FLG %S %S"),&logFileName,&n); |
600 } else |
615 } |
601 { |
616 else |
602 TPckg<TLogFile> logFilePckg(iLogFile); |
617 { |
603 iLastError=SendReceive(EWriteLog,TIpcArgs (&logFilePckg, &aBuf)); |
618 TPckg<TLogFile> logFilePckg(iLogFile); |
604 } |
619 iLastError=SendReceive(EWriteLog,TIpcArgs (&logFilePckg, &aBuf)); |
|
620 } |
605 } |
621 } |
606 |
622 |
607 void RFileLogger::DoStaticWrite(const TDesC8& aBuf) |
623 void RFileLogger::DoStaticWrite(const TDesC8& aBuf) |
608 /** |
624 /** |
609 Sends the pre-formatted write string to the flogger server. |
625 Sends the pre-formatted write string to the flogger server. |
622 { |
638 { |
623 TBuf<KLogBufferSize> n; |
639 TBuf<KLogBufferSize> n; |
624 n.Copy(aBuf); |
640 n.Copy(aBuf); |
625 TFileName logFileName = iLogFile.Name(); |
641 TFileName logFileName = iLogFile.Name(); |
626 RDebug::Print(_L("FLG %S %S"),&logFileName,&n); |
642 RDebug::Print(_L("FLG %S %S"),&logFileName,&n); |
627 } else |
643 } |
628 { |
644 else |
629 SendReceive(ECreateWriteAndCloseLog, TIpcArgs( &logFilePckg, &aBuf)); // ignore error |
645 { |
630 } |
646 SendReceive(ECreateWriteAndCloseLog, TIpcArgs( &logFilePckg, &aBuf)); // ignore error |
|
647 } |
631 } |
648 } |
632 |
649 |
633 void RFileLogger::DoWriteFormat(TRefByValue<const TDesC16> aFmt, VA_LIST& aList) |
650 void RFileLogger::DoWriteFormat(TRefByValue<const TDesC16> aFmt, VA_LIST& aList) |
634 /** |
651 /** |
635 Trim format string before sending to the flogger server. |
652 Trim format string before sending to the flogger server. |