|
1 /* |
|
2 * Copyright (c) 2004 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: Logger headerfile for CbsServer |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 |
|
20 #ifndef CBSLOGGER_H |
|
21 #define CBSLOGGER_H |
|
22 |
|
23 /* |
|
24 ----------------------------------------------------------------------------- |
|
25 LOG SELECTION |
|
26 ----------------------------------------------------------------------------- |
|
27 */ |
|
28 #ifndef _DEBUG |
|
29 // UREL BUILD: |
|
30 #define CBS_LOGGING_METHOD 0 // No logging in UREL builds |
|
31 #else |
|
32 // UDEB BUILD: |
|
33 #define CBS_LOGGING_METHOD 1 // 0 = No logging, |
|
34 // 1 = Flogger, |
|
35 // 2 = RDebug |
|
36 #endif //_DEBUG |
|
37 |
|
38 |
|
39 #if CBS_LOGGING_METHOD > 0 |
|
40 #define CBS_LOGGING_ENABLED // This is for backward compatibility |
|
41 #endif //CBS_LOGGING_METHOD |
|
42 |
|
43 /* |
|
44 ----------------------------------------------------------------------------- |
|
45 FLOGGER SETTINGS |
|
46 ----------------------------------------------------------------------------- |
|
47 */ |
|
48 #if CBS_LOGGING_METHOD == 1 // Flogger |
|
49 |
|
50 #include <flogger.h> |
|
51 |
|
52 _LIT(KCbsLogFolder, "TF"); |
|
53 _LIT(KCbsLogFile, "TFLOG.TXT"); |
|
54 |
|
55 #elif CBS_LOGGING_METHOD == 2 // RDebug |
|
56 |
|
57 #include <e32svr.h> |
|
58 |
|
59 #endif //CBS_LOGGING_METHOD |
|
60 |
|
61 |
|
62 /* |
|
63 ----------------------------------------------------------------------------- |
|
64 LOGGING MACROs |
|
65 |
|
66 USE THESE MACROS IN YOUR CODE ! |
|
67 ----------------------------------------------------------------------------- |
|
68 */ |
|
69 |
|
70 |
|
71 #if CBS_LOGGING_METHOD == 1 // Flogger |
|
72 |
|
73 #define CBSLOGTEXT(AAA) /*lint -save -e960 */ { RFileLogger::Write(KCbsLogFolder(),KCbsLogFile(),EFileLoggingModeAppend,AAA); } /*lint -restore */ |
|
74 #define CBSLOGSTRING(AAA) /*lint -save -e960 */ { _LIT(tempLogDes,AAA); RFileLogger::Write(KCbsLogFolder(),KCbsLogFile(),EFileLoggingModeAppend,tempLogDes()); } /*lint -restore */ |
|
75 #define CBSLOGSTRING2(AAA,BBB) /*lint -save -e960 -e437 */ { _LIT(tempLogDes,AAA); RFileLogger::WriteFormat(KCbsLogFolder(),KCbsLogFile(),EFileLoggingModeAppend,TRefByValue<const TDesC>(tempLogDes()),BBB); } /*lint -restore */ |
|
76 #define CBSLOGSTRING3(AAA,BBB,CCC) /*lint -save -e960 */ { _LIT(tempLogDes,AAA); RFileLogger::WriteFormat(KCbsLogFolder(),KCbsLogFile(),EFileLoggingModeAppend,TRefByValue<const TDesC>(tempLogDes()),BBB,CCC); } /*lint -restore */ |
|
77 |
|
78 #elif CBS_LOGGING_METHOD == 2 // RDebug |
|
79 |
|
80 #define CBSLOGTEXT(AAA) RDebug::Print(AAA); |
|
81 #define CBSLOGSTRING(AAA) RDebug::Print(_L(AAA)); |
|
82 #define CBSLOGSTRING2(AAA,BBB) RDebug::Print(_L(AAA),BBB); |
|
83 #define CBSLOGSTRING3(AAA,BBB,CCC) RDebug::Print(_L(AAA),BBB,CCC); |
|
84 |
|
85 #else // CBS_LOGGING_METHOD == 0 or invalid |
|
86 |
|
87 // Example: CBSLOGTEXT(own_desc); |
|
88 #define CBSLOGTEXT(AAA) |
|
89 // Example: CBSLOGSTRING("Test"); |
|
90 #define CBSLOGSTRING(AAA) |
|
91 // Example: CBSLOGSTRING("Test %i", aValue); |
|
92 #define CBSLOGSTRING2(AAA,BBB) |
|
93 // Example: CBSLOGSTRING("Test %i %i", aValue1, aValue2); |
|
94 #define CBSLOGSTRING3(AAA,BBB,CCC) |
|
95 |
|
96 #endif // CBS_LOGGING_METHOD |
|
97 |
|
98 #endif // CBSLOGGER_H |
|
99 |
|
100 // End of File |