|
1 // Copyright (c) 2004-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 #if !defined(__E32BASE_H__) |
|
17 #include <e32base.h> |
|
18 #endif |
|
19 |
|
20 #if !defined(__F32FILE_H__) |
|
21 #include <f32file.h> |
|
22 #endif |
|
23 |
|
24 _LIT(KLogFileName, "C:\\MsgLogs\\T_GMXMLFAILURE"); |
|
25 _LIT8(KLogErrorString, "** %S %d"); |
|
26 _LIT8(KLogCommentString, " %S"); |
|
27 _LIT8(KLogCR, "\r\n"); |
|
28 _LIT(KLogDateFormatString, "%D%M%*Y%1%/1%2%/2%3 %H%:1%T%:2%S"); |
|
29 |
|
30 |
|
31 // Setting to select whether a new log file will be created, |
|
32 // or existing one will be appended to... |
|
33 |
|
34 /** |
|
35 @internalTechnology |
|
36 @released |
|
37 */ |
|
38 enum TImLogOpenMode |
|
39 { |
|
40 EReplace, |
|
41 EAppend |
|
42 }; |
|
43 |
|
44 class CImLog : public CBase |
|
45 /** |
|
46 @internalTechnology |
|
47 @released |
|
48 */ |
|
49 { |
|
50 public: |
|
51 static CImLog* NewL(const TDesC& aFullFilePath, TImLogOpenMode aImLogOpenMode); |
|
52 ~CImLog(); |
|
53 |
|
54 void AppendComment(const TDesC8& aMessage); |
|
55 void AppendError(const TDesC8& aErrorMessage, TInt aErrorCode); |
|
56 private: |
|
57 CImLog(); |
|
58 void ConstructL(const TDesC& aFullFilePath, TImLogOpenMode aImLogOpenMode); |
|
59 |
|
60 void BuildLogString(const TDesC8& aFormat,const TDesC8& aOutPut, TBool aWriteCrLf = EFalse); |
|
61 void WriteToLog(TRefByValue<const TDesC8> aFmt,...); |
|
62 private: |
|
63 RFile iFile; |
|
64 RFs iFs; |
|
65 }; |
|
66 |