|
1 // Copyright (c) 1998-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 the License "Symbian Foundation License v1.0" to Symbian Foundation members and "Symbian Foundation End User License Agreement v1.0" to non-members |
|
5 // which accompanies this distribution, and is available |
|
6 // at the URL "http://www.symbianfoundation.org/legal/licencesv10.html". |
|
7 // |
|
8 // Initial Contributors: |
|
9 // Nokia Corporation - initial contribution. |
|
10 // |
|
11 // Contributors: |
|
12 // |
|
13 // Description: |
|
14 // |
|
15 |
|
16 #if !defined(__MIUTLOG_H__) |
|
17 #define __MIUTLOG_H__ |
|
18 |
|
19 #if !defined(__E32BASE_H__) |
|
20 #include <e32base.h> |
|
21 #endif |
|
22 |
|
23 #if !defined(__F32FILE_H__) |
|
24 #include <f32file.h> |
|
25 #endif |
|
26 |
|
27 _LIT(KMiutLogFile, "c:\\logs\\Email\\ImLog%d"); |
|
28 _LIT(KMiutLogFileExtension, ".txt"); |
|
29 _LIT(KMiutLogUnopenedFileFormatString, "%S(%u).txt"); |
|
30 _LIT8(KMiutLogOutputString, ">> %S"); |
|
31 _LIT8(KMiutLogResponseString, "<< %S"); |
|
32 _LIT8(KMiutLogErrorString, "** %S %d"); |
|
33 _LIT8(KMiutLogCommentString, "** %S"); |
|
34 _LIT8(KMiutLogCR, "\r\n"); |
|
35 _LIT(KMiutLogDateFormatString, "%D%M%*Y%1%/1%2%/2%3 %H%:1%T%:2%S "); |
|
36 |
|
37 |
|
38 // Setting to select whether a new log file will be created, |
|
39 // or existing one will be appended to... |
|
40 |
|
41 /** |
|
42 @internalTechnology |
|
43 @released |
|
44 */ |
|
45 enum TImLogOpenMode |
|
46 { |
|
47 EReplace, |
|
48 EAppend |
|
49 }; |
|
50 |
|
51 class CImLog : public CBase |
|
52 /** |
|
53 @internalTechnology |
|
54 @released |
|
55 */ |
|
56 { |
|
57 public: |
|
58 IMPORT_C static CImLog* NewL(const TDesC& aFullFilePath, TImLogOpenMode aImLogOpenMode); |
|
59 IMPORT_C static CImLog* NewL(TInt aPortNum); |
|
60 IMPORT_C ~CImLog(); |
|
61 |
|
62 IMPORT_C void AppendOut(const TDesC8 &outPut); |
|
63 IMPORT_C void AppendResponse(const TDesC8 &theResponse); |
|
64 IMPORT_C void AppendComment(const TDesC8 &theError); |
|
65 IMPORT_C void AppendError(const TDesC8 &theError, TInt anErrorCode); |
|
66 private: |
|
67 CImLog(); |
|
68 void ConstructL(TInt aPortNum); |
|
69 void ConstructL(const TDesC& aFullFilePath, TImLogOpenMode aImLogOpenMode); |
|
70 |
|
71 void BuildLogString(const TDesC8& aFormat,const TDesC8 &theOutPut, TBool aWriteCrLf = EFalse); |
|
72 void WriteToLog(TRefByValue<const TDesC8> aFmt,...); |
|
73 private: |
|
74 RFile iFile; |
|
75 RFs iFs; |
|
76 }; |
|
77 |
|
78 #endif |