|
1 /* |
|
2 * Copyright (c) 2006-2009 Nokia Corporation and/or its subsidiary(-ies). |
|
3 * All rights reserved. |
|
4 * This component and the accompanying materials are made available |
|
5 * under the terms of "Eclipse Public License v1.0" |
|
6 * which accompanies this distribution, and is available |
|
7 * at the URL "http://www.eclipse.org/legal/epl-v10.html". |
|
8 * |
|
9 * Initial Contributors: |
|
10 * Nokia Corporation - initial contribution. |
|
11 * |
|
12 * Contributors: |
|
13 * |
|
14 * Description: Contained MRT library code tracing macros and class definition. |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 #ifndef LIB_LOGGER_HANDLER_H |
|
20 #define LIB_LOGGER_HANDLER_H |
|
21 |
|
22 // INCLUDES |
|
23 #include <e32base.h> |
|
24 #include "liblogger.h" |
|
25 |
|
26 // FORWARD DECLARATIONS |
|
27 class RFile; |
|
28 class RFs; |
|
29 |
|
30 // FORWARD DECLARATIONS |
|
31 /* |
|
32 * Here, we are providing all utility functions that will be |
|
33 * used by all modules. We are expecting that all codes specific |
|
34 * to symbian will use active object for asynchronous handling |
|
35 * of all their functionalities. In case of thread provide |
|
36 * synchnorization for accessing the shared objects. |
|
37 */ |
|
38 |
|
39 NONSHARABLE_CLASS ( CLibLogger ) |
|
40 { |
|
41 private: |
|
42 /* |
|
43 * create one session with file server |
|
44 */ |
|
45 static int CreateFileSession(RFs &aFsSession, RFile &aFile); |
|
46 |
|
47 /* |
|
48 * create one session with file server |
|
49 */ |
|
50 static void GetLogFilename(TDes& aFileName); |
|
51 |
|
52 /* |
|
53 * Write message to the log file |
|
54 */ |
|
55 static TInt WriteMessage(const TDesC8& aMessage); |
|
56 |
|
57 /* |
|
58 * Default constructor |
|
59 */ |
|
60 CLibLogger() {} |
|
61 |
|
62 /* all the methods within this class are public and static. */ |
|
63 public: |
|
64 /* logging related */ |
|
65 |
|
66 /* |
|
67 * Message logging interface |
|
68 */ |
|
69 static int LogMessage(TLibTraceMessageType aLogMessageType, |
|
70 char *aFileName, |
|
71 int aLine, |
|
72 char *aFormat, |
|
73 VA_LIST& aMarkerList); |
|
74 |
|
75 /* |
|
76 * Only filename and line number with timestamp. |
|
77 */ |
|
78 static int LogMessage(char *aFileName, int aLine); |
|
79 |
|
80 /* |
|
81 * Only message without timestamp |
|
82 */ |
|
83 static int LogMessage(TLibTraceMessageType aLogMessageType, |
|
84 char *aFormat, |
|
85 VA_LIST& aMarkerList); |
|
86 |
|
87 /* |
|
88 * dumping the message in hex format |
|
89 */ |
|
90 static int DumpMessage(TLibTraceMessageType aLogMessageType, |
|
91 char *aFileName, |
|
92 int aLine, |
|
93 char* aMessage, |
|
94 char *aStr, |
|
95 int aStrLen = -1); |
|
96 |
|
97 /* |
|
98 * dumping the message in hex format |
|
99 */ |
|
100 static int DumpMessage(char *aStr, int aStrLen); |
|
101 |
|
102 /* |
|
103 * dumping the message in hex format |
|
104 */ |
|
105 static int DumpFormatMessage(TLibTraceMessageType aLogMessageType, |
|
106 char *aFileName, |
|
107 int aLine, |
|
108 char *aMessage, |
|
109 char *aFormat, |
|
110 VA_LIST& aMarkerList); |
|
111 /* |
|
112 * dumping the message in hex format |
|
113 */ |
|
114 static int DumpFormatMessage(TLibTraceMessageType aLogMessageType, |
|
115 char *aMessage, |
|
116 char *aFormat, |
|
117 VA_LIST& aMarkerList); |
|
118 }; |
|
119 |
|
120 #endif //LIBC_LOGGER_HANDLER_H |
|
121 |
|
122 |
|
123 // End of file |