|
1 // Copyright (c) 2008-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 /** |
|
17 @file |
|
18 @internalTechnology |
|
19 |
|
20 */ |
|
21 |
|
22 #ifndef SUPL_DEV_LOGGER_H |
|
23 #define SUPL_DEV_LOGGER_H |
|
24 |
|
25 //************************************************************************************************************ |
|
26 #include <e32base.h> |
|
27 |
|
28 // Literals used |
|
29 _LIT(KSuplDevLogger, "SuplDevLogger"); |
|
30 |
|
31 //------------------------------------------------------------------------------- |
|
32 /** Enum for log txt priority |
|
33 Priorities 0 - 2 are for logging component internal events. |
|
34 Priority 3 is for logging major component events that may have a major influence on other components. |
|
35 Priorities 4 - 5 are currently unassigned (TBD) |
|
36 Priorities 6 - 7 are for logging internal API |
|
37 Priorities 8 - 9 are for logging public API |
|
38 @internalTechnology |
|
39 @deprecated |
|
40 */ |
|
41 enum TSuplLogPriority |
|
42 { |
|
43 /** The lowest priority. Use for hex dump and other low priority information. */ |
|
44 ELogP0 = 0, |
|
45 /** Use for method enter/exit logging. */ |
|
46 ELogP1 = 1, |
|
47 /** Use for low priority, component internal event and data logging. */ |
|
48 ELogP2 = 2, |
|
49 /** Use for important component events like timeouts, warnings and errors. */ |
|
50 ELogP3 = 3, |
|
51 /** TBD (May temporarily contain old values that should be P7)*/ |
|
52 ELogP4 = 4, |
|
53 /** TBD (May temporarily contain old entries that should be P9)*/ |
|
54 ELogP5 = 5, |
|
55 /** Use for Internal API */ |
|
56 ELogP6 = 6, //Minor Values |
|
57 ELogP7 = 7, //Major Values |
|
58 /** The highest priority. Use only for really major user, network or hardware events and Published API |
|
59 values. For example: |
|
60 - MTLR/X3P/Self locate request/response/cancel |
|
61 - location update from GPS |
|
62 - change in configuration |
|
63 - privacy response from user |
|
64 - Sequence Diagram log entries*/ |
|
65 ELogP8 = 8, //Minor Values |
|
66 ELogP9 = 9 //Major Values |
|
67 }; |
|
68 |
|
69 /** Log entry type. |
|
70 @internalTechnology |
|
71 @deprecated |
|
72 */ |
|
73 enum TSuplLogType |
|
74 { |
|
75 ELogNormal = 0, |
|
76 ELogWarning = 1, |
|
77 ELogError = 2 |
|
78 }; |
|
79 |
|
80 //------------------------------------------------------------------------------- |
|
81 /** Logger for development and debug purpose |
|
82 The log format will be |
|
83 |
|
84 Time | ProcessName | Process Id | Log Priority | StackPointer | Log text |
|
85 08:51:00.997500 | File Name | Process Id | Log Text Priority | StackPointer | Any Log text |
|
86 |
|
87 note the maximum buffer size limitation KLogBufferSize=150 |
|
88 |
|
89 [File Name] see RProcess::FileName() |
|
90 [Process Id]see RProcess::Id() |
|
91 [Log Text Priority] - [P0]- [P9] |
|
92 |
|
93 @internalTechnology |
|
94 @deprecated |
|
95 */ |
|
96 class SuplDevLogger |
|
97 { |
|
98 public: |
|
99 IMPORT_C static void OverWrite(const TDesC8& aFmt); |
|
100 IMPORT_C static void OverWrite(const TDesC16& aFmt); |
|
101 |
|
102 IMPORT_C static void Write(TSuplLogType aType, TSuplLogPriority aPrior, TRefByValue<const TDesC16> aFmt, ...); |
|
103 IMPORT_C static void Write(TSuplLogType aType, TSuplLogPriority aPrior, TRefByValue<const TDesC8> aFmt, ...); |
|
104 |
|
105 IMPORT_C static void HexDump(TSuplLogPriority aPrior, const TUint8 *aPtr, TInt aLen); |
|
106 |
|
107 IMPORT_C static void GetMessageProcessName(const RMessage2& aMessage, TFileName& aName); |
|
108 private: |
|
109 static void CreateLogTxt(TSuplLogType aType, TSuplLogPriority aPrior, TInt* aStackPtr, TDes16& aBuf); |
|
110 static void CreateLogTxt(TSuplLogType aType, TSuplLogPriority aPrior, TInt* aStackPtr, TDes8& aBuf); |
|
111 }; |
|
112 |
|
113 #endif //SUPL_DEV_LOGGER_H |