|
1 // Copyright (c) 2001-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 // InuLogger.h |
|
15 // |
|
16 // |
|
17 |
|
18 #ifndef __INULOGGER_H__ |
|
19 #define __INULOGGER_H__ |
|
20 |
|
21 #include <e32std.h> |
|
22 #include <Flogger.h> |
|
23 |
|
24 |
|
25 // HTTP Logging class |
|
26 //##ModelId=3A914DF60214 |
|
27 class TInuLogger |
|
28 { |
|
29 public: // methods |
|
30 |
|
31 // Destructor - closes the log |
|
32 //##ModelId=3A914DF60249 |
|
33 IMPORT_C ~TInuLogger(); |
|
34 |
|
35 // Create log file in directory KLogsdir\KWapLogsDirName - Note: ingore Drive and Path of aFilename |
|
36 //##ModelId=3A914DF6023F |
|
37 IMPORT_C void CreateFlogger(const TDesC& aFileName, TInt aShowDate, TInt aShowTime); |
|
38 |
|
39 //##ModelId=3A914DF6023C |
|
40 IMPORT_C void LogIt(TRefByValue<const TDesC> aFmt, ...); |
|
41 |
|
42 // Writes aComment to test log file, logging file and test harness |
|
43 //##ModelId=3A914DF60232 |
|
44 IMPORT_C void WriteComment(const TDesC& aComment); |
|
45 |
|
46 // Do a formatted dump of binary data |
|
47 //##ModelId=3A914DF6022B |
|
48 IMPORT_C void DumpIt(const TDesC8& aData); |
|
49 |
|
50 // Do a write of the supplied 8 bit data |
|
51 //##ModelId=3A914DF60234 |
|
52 IMPORT_C void WriteComment(const TDesC8& aData); |
|
53 |
|
54 private: // attributes |
|
55 |
|
56 // Logger handle |
|
57 //##ModelId=3A914DF60228 |
|
58 RFileLogger iLogger; |
|
59 }; |
|
60 |
|
61 // By default, logging will always be switched on. Later, this may be removed, leaving it to individual |
|
62 // source files to enable logging where needed. |
|
63 #define _LOGGING |
|
64 |
|
65 #if defined (_DEBUG) && defined (_LOGGING) |
|
66 |
|
67 // HTTP Logging macros |
|
68 #define __DECLARE_LOG TInuLogger iLogger; |
|
69 #define __OPEN_LOG(L) iLogger.CreateFlogger(_L(L), ETrue, ETrue); |
|
70 #define __OPEN_LOG2(L) iLogger.CreateFlogger(L, ETrue, ETrue); |
|
71 #define __LOG(C) iLogger.WriteComment(C); |
|
72 #define __LOG1(C, X) iLogger.LogIt(C, X); |
|
73 #define __LOG2(C, X, Y) iLogger.LogIt(C, X, Y); |
|
74 #define __LOG3(C, X, Y, Z) iLogger.LogIt(C, X, Y, Z); |
|
75 #define __DUMPBIN(D) iLogger.DumpIt(D); |
|
76 #define __QINFO(aText) {User::InfoPrint(aText); User::After(1000000);} |
|
77 |
|
78 #else if !defined (_DEBUG) |
|
79 |
|
80 // NULL macros |
|
81 #define __DECLARE_LOG |
|
82 #define __OPEN_LOG(L) |
|
83 #define __OPEN_LOG2(L) |
|
84 #define __LOG(C) |
|
85 #define __LOG1(C, X) |
|
86 #define __LOG2(C, X, Y) |
|
87 #define __LOG3(C, X, Y, Z) |
|
88 #define __DUMPBIN(D) |
|
89 #define __QINFO(aText) |
|
90 #endif // !_DEBUG |
|
91 |
|
92 #endif // __InuLOGGER_H__ |