|
1 // Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies). |
|
2 // All rights reserved. |
|
3 // This component and the accompanying materials are made available |
|
4 // under the terms of "Eclipse Public License v1.0" |
|
5 // which accompanies this distribution, and is available |
|
6 // at the URL "http://www.eclipse.org/legal/epl-v10.html". |
|
7 // |
|
8 // Initial Contributors: |
|
9 // Nokia Corporation - initial contribution. |
|
10 // |
|
11 // Contributors: |
|
12 // |
|
13 // Description: |
|
14 // |
|
15 |
|
16 /** |
|
17 @file testlog.h |
|
18 @internalComponent |
|
19 */ |
|
20 |
|
21 |
|
22 #ifndef TESTLOG_H |
|
23 #define TESTLOG_H |
|
24 |
|
25 #include <e32base.h> |
|
26 #include <f32file.h> |
|
27 #include <e32cons.h> |
|
28 #include "epocerror.h" |
|
29 |
|
30 |
|
31 #define MAX_BUF_LENGTH 1024 |
|
32 #define MAX_FILENAME_LENGTH 64 |
|
33 |
|
34 class CTestLog : public CBase |
|
35 /** |
|
36 @internalComponent |
|
37 */ |
|
38 { |
|
39 public: |
|
40 static CTestLog* NewLC(RFs &aFsSession, TPtrC aFilename, TBool aDebugOn, CConsoleBase* aConsole); |
|
41 void Msg(TPtrC aText, ...); |
|
42 void Dbg(TPtrC aText, ...); |
|
43 void CloseFile(); |
|
44 inline TPtrC GetError(); |
|
45 void WriteErrorMessage(const TPtrC &aMessage); |
|
46 ~CTestLog(); |
|
47 |
|
48 void DiagPrint(const TText8* aFile, TInt aLine, TPtrC aSeverity, TPtrC aText, ...); |
|
49 |
|
50 protected: |
|
51 CTestLog() |
|
52 { |
|
53 } |
|
54 void ConstructL(RFs &aFsSession, TPtrC aFilename, TBool aDebugOn, CConsoleBase* aConsole); |
|
55 private: |
|
56 TBool iInitialised; |
|
57 TBool iDebug; |
|
58 RFile iFile; |
|
59 CConsoleBase* iConsole; |
|
60 CEpocError iErr; |
|
61 // temp buffer |
|
62 TBuf<MAX_BUF_LENGTH> iBuf; |
|
63 |
|
64 TBool WriteBufferToFile(TDesC16 &aBuffer, RFile &aHandle); |
|
65 }; |
|
66 |
|
67 inline TPtrC CTestLog::GetError() |
|
68 { |
|
69 return iErr.LastErrorMessage(); |
|
70 } |
|
71 |
|
72 |
|
73 #endif |