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