// ========================================================================== // METHOD: Write // // DESIGN: Write the given buffer. Chunk the string if it is longer than // KDebugLogBufferSize. // ========================================================================== void CLogFileHandler::Write( const TDesC8& aClassName, const TDesC8& aFuncName, const TDesC8& aDes ) { TRAP_IGNORE( AddTimestampToOutputBufferL() ); TInt prefixLength = iOutputBuffer.Length(); TRAP_IGNORE( AddClassAndFunctionToOutputBufferL( aClassName, aFuncName ) ); TInt curPos = 0; while( curPos < aDes.Length() ) { TInt lengthToWrite = Min( KMaxTextPerLine - iOutputBuffer.Length(), aDes.Length() - curPos ); TRAP_IGNORE( WriteLineL( aDes.Mid( curPos, lengthToWrite ) ) ); iOutputBuffer.SetLength( prefixLength ); curPos += lengthToWrite; } // end while } // END Write
// ========================================================================== // METHOD: HexDump // // DESIGN: // ========================================================================== void CLogFileHandler::HexDump( const TDesC8& /*aClassName*/, const TDesC8& /*aFuncName*/, const TDesC8& aBuffer ) { TInt remainingLength = aBuffer.Length(); TInt i = 0; while( remainingLength > 0 ) { const TInt KHexDumpWidth=32; TInt n = Min( KHexDumpWidth, remainingLength ); // Add the starting byte number. _LIT8(KFirstFormatString,"%04x : "); iFormatBuffer8.Format(KFirstFormatString, i); // Add hex values. TInt j; for (j=0; j<n; j++) { _LIT8(KSecondFormatString,"%02x "); iFormatBuffer8.AppendFormat(KSecondFormatString, aBuffer[i+j]); } // end for // Fill in incomplete lines. while (j<KHexDumpWidth) { _LIT8(KThreeSpaces," "); iFormatBuffer8.Append(KThreeSpaces); j++; } // end while // Add text representation. _LIT8(KTwoSpaces," "); iFormatBuffer8.Append(KTwoSpaces); for (j=0; j<n; j++) { _LIT8(KThirdFormatString,"%c"); iFormatBuffer8.AppendFormat( KThirdFormatString, aBuffer[i+j] ); } // end for iOutputBuffer.SetLength( 0 ); TRAP_IGNORE( WriteLineL( iFormatBuffer8 ) ); remainingLength -= n; i += n; } // end while } // END HexDump
void CSALogger::WriteLineL(const TDesC& aText) { WriteL(aText); WriteLineL(); }
void CSALogger::WriteLineL(TInt aInt) { WriteL(aInt); WriteLineL(); }