|
1 /* |
|
2 * Copyright (c) 2007 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: Provides logging services. |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 #ifndef ALWAYSONLOGGER_H |
|
20 #define ALWAYSONLOGGER_H |
|
21 |
|
22 #ifdef _DEBUG |
|
23 // 0 = No logging, |
|
24 #define LOGGING_METHOD 1 // 1 = Flogger, |
|
25 // 2 = RDebug |
|
26 #else |
|
27 |
|
28 #define LOGGING_METHOD 0 // No logging in UREL builds |
|
29 |
|
30 #endif // _DEBUG |
|
31 |
|
32 |
|
33 #if LOGGING_METHOD == 1 // Flogger |
|
34 |
|
35 #include <flogger.h> |
|
36 _LIT(KLOGFolder,"ALWAYSONADAPTER"); |
|
37 _LIT(KLOGFile,"ALWAYSONADAPTER.txt"); |
|
38 |
|
39 #define LOGTEXT(x)\ |
|
40 {\ |
|
41 RFileLogger::Write(KLOGFolder(),KLOGFile(),EFileLoggingModeAppend,\ |
|
42 x);\ |
|
43 } |
|
44 |
|
45 #define LOGSTRING(x)\ |
|
46 {\ |
|
47 _LIT8(tempLogDes,x);\ |
|
48 RFileLogger::Write(KLOGFolder(),KLOGFile(),EFileLoggingModeAppend,\ |
|
49 tempLogDes());\ |
|
50 } |
|
51 |
|
52 #define LOGSTRING2(x,y)\ |
|
53 { _LIT8(tempLogDes,x);\ |
|
54 RFileLogger::WriteFormat(KLOGFolder(),\ |
|
55 KLOGFile(),\ |
|
56 EFileLoggingModeAppend,\ |
|
57 TRefByValue<const TDesC8>(tempLogDes()),y);\ |
|
58 } |
|
59 |
|
60 #define LOGSTRING3(x,y,z)\ |
|
61 { _LIT8(tempLogDes,x);\ |
|
62 RFileLogger::WriteFormat(KLOGFolder(),\ |
|
63 KLOGFile(),\ |
|
64 EFileLoggingModeAppend,\ |
|
65 TRefByValue<const TDesC8>(tempLogDes()),y,z);\ |
|
66 } |
|
67 |
|
68 #define LOGSTRING4(w,x,y,z)\ |
|
69 { _LIT8(tempLogDes,w);\ |
|
70 RFileLogger::WriteFormat(KLOGFolder(),\ |
|
71 KLOGFile(),\ |
|
72 EFileLoggingModeAppend,\ |
|
73 TRefByValue<const TDesC8>(tempLogDes()),x,y,z);\ |
|
74 } |
|
75 |
|
76 |
|
77 #elif _LOGGING_METHOD == 2 // RDebug |
|
78 |
|
79 #include <e32svr.h> |
|
80 |
|
81 #define LOGSTRING(x) RDebug::Print(x); |
|
82 #define LOGSTRING(x) RDebug::Print(_L(x)); |
|
83 #define LOGSTRING2(x,y) RDebug::Print(_L(x),y); |
|
84 #define LOGSTRING3(x,y,z) RDebug::Print(_L(x),y,z); |
|
85 #define LOGSTRING4(w,x,y,z) RDebug::Print(_L(w),x,y,z); |
|
86 |
|
87 #else // LOGGING_METHOD == 0 or invalid |
|
88 |
|
89 #define LOGSTRING(x) |
|
90 #define LOGSTRING(x) |
|
91 #define LOGSTRING2(x,y) |
|
92 #define LOGSTRING3(x,y,z) |
|
93 #define LOGSTRING4(w,x,y,z) |
|
94 |
|
95 #endif // LOGGING_METHOD |
|
96 |
|
97 #endif // ALWAYSONLOGGER_H |
|
98 |
|
99 // End of File |