|
1 // Copyright (c) 2006-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 #ifndef LBS_TEST_LOGGER_H |
|
17 #define LBS_TEST_LOGGER_H |
|
18 |
|
19 //************************************************************************************************************ |
|
20 #include <e32base.h> |
|
21 |
|
22 //------------------------------------------------------------------------------- |
|
23 /** Enum for log txt priority |
|
24 Priorities 0 - 2 are for logging component internal events. |
|
25 Priority 3 is for logging major component events that may have a major influence on other components. |
|
26 Priorities 3 - 4 are for logging lbs system level events. |
|
27 @internalTechnology |
|
28 @released |
|
29 */ |
|
30 enum TLogPriority |
|
31 { |
|
32 /** The lowest priority. Use for hex dump and other low priority information. */ |
|
33 ELogP0 = 0, |
|
34 /** Use for method enter/exit logging. */ |
|
35 ELogP1 = 1, |
|
36 /** Use for low priority, component internal event and data logging. */ |
|
37 ELogP2 = 2, |
|
38 /** Use for important component events like timeouts, warnings and errors. */ |
|
39 ELogP3 = 3, |
|
40 /** Use for IPC only. */ |
|
41 ELogP4 = 4, |
|
42 /** The highest priority. Use only for really major user, network or hardware events.*/ |
|
43 ELogP5 = 5 |
|
44 }; |
|
45 |
|
46 /** Log entry type. |
|
47 @internalTechnology |
|
48 @released |
|
49 */ |
|
50 enum TLogType |
|
51 { |
|
52 ELogNormal = 0, |
|
53 ELogWarning = 1, |
|
54 ELogError = 2 |
|
55 }; |
|
56 |
|
57 //------------------------------------------------------------------------------- |
|
58 /** Logger for development and debug purpose |
|
59 The log format will be |
|
60 |
|
61 Time File name Process Id Log Priority Log text |
|
62 [08:51:00.997500] [File Name] [Process Id] [Log Text Priority] Any Log text |
|
63 |
|
64 note the maximum buffer size limitation KLogBufferSize=150 |
|
65 |
|
66 [File Name] see RProcess::FileName() |
|
67 [Process Id]see RProcess::Id() |
|
68 [Log Text Priority] - [P0]- [P5] |
|
69 |
|
70 @internalTechnology |
|
71 @released |
|
72 */ |
|
73 class LbsTestLogger |
|
74 { |
|
75 public: |
|
76 |
|
77 static void Write(TLogType aType, TLogPriority aPrior, TRefByValue<const TDesC16> aFmt, ...); |
|
78 static void Write(TLogType aType, TLogPriority aPrior, TRefByValue<const TDesC8> aFmt, ...); |
|
79 |
|
80 static void HexDump(TLogPriority aPrior, const TUint8 *aPtr, TInt aLen); |
|
81 |
|
82 private: |
|
83 static void CreateLogDir(); |
|
84 static void CreateLogTxt(TLogType aType, TLogPriority aPrior, TDes16& aBuf); |
|
85 static void CreateLogTxt(TLogType aType, TLogPriority aPrior, TDes8& aBuf); |
|
86 }; |
|
87 |
|
88 #endif //LBS_TEST_LOGGER_H |