|
1 /* |
|
2 * Copyright (c) 2004-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 macros for logging |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 |
|
20 #ifndef RCSELOGGER_H |
|
21 #define RCSELOGGER_H |
|
22 |
|
23 // INCLUDES |
|
24 #include <e32def.h> |
|
25 |
|
26 |
|
27 //----------------------------------------------------------------------------- |
|
28 // USER LOGGING SETTINGS |
|
29 //----------------------------------------------------------------------------- |
|
30 |
|
31 #ifndef _DEBUG |
|
32 |
|
33 /*************************** |
|
34 * Logging method variants: |
|
35 * 0 = No logging |
|
36 * 1 = Flogger |
|
37 * 2 = RDebug |
|
38 ***************************/ |
|
39 |
|
40 #define RCSE_LOGGING_METHOD 0 // UREL BUILD |
|
41 |
|
42 #else |
|
43 |
|
44 #ifdef __WINS__ |
|
45 #define RCSE_LOGGING_METHOD 2 // UDEB BUILD, WINS |
|
46 #else |
|
47 #define RCSE_LOGGING_METHOD 2 // UDEB BUILD, HW |
|
48 #endif // __WINS__ |
|
49 |
|
50 #endif // _DEBUG |
|
51 |
|
52 |
|
53 //----------------------------------------------------------------------------- |
|
54 // LOGGING SETTINGS (DO NOT EDIT) |
|
55 //----------------------------------------------------------------------------- |
|
56 |
|
57 #if RCSE_LOGGING_METHOD == 1 // Flogger |
|
58 |
|
59 #include <flogger.h> |
|
60 _LIT(KRCSELogFolder,"RCSE"); |
|
61 _LIT(KRCSELogFile,"RCSELOG.TXT"); |
|
62 |
|
63 #elif RCSE_LOGGING_METHOD == 2 // RDebug |
|
64 |
|
65 #include <e32svr.h> |
|
66 |
|
67 #endif |
|
68 |
|
69 |
|
70 //----------------------------------------------------------------------------- |
|
71 // LOGGING MACROs (DO NOT EDIT) |
|
72 // |
|
73 // USE THESE MACROS IN YOUR CODE |
|
74 //----------------------------------------------------------------------------- |
|
75 |
|
76 #if RCSE_LOGGING_METHOD == 1 // Flogger |
|
77 |
|
78 #define RCSELOGSTRING(AA) { RFileLogger::Write(KRCSELogFolder(),KRCSELogFile(),EFileLoggingModeAppend, _L(AA) ); } |
|
79 #define RCSELOGSTRING2(AA,BB) { RFileLogger::WriteFormat(KRCSELogFolder(),KRCSELogFile(),EFileLoggingModeAppend,TRefByValue<const TDesC>(_L(AA)),BB); } |
|
80 #define RCSELOGSTRING3(AA,BB,CC) { RFileLogger::WriteFormat(KRCSELogFolder(),KRCSELogFile(),EFileLoggingModeAppend,TRefByValue<const TDesC>(_L(AA)),BB,CC); } |
|
81 #define RCSELOGSTRING4(AA,BB,CC,DD) { RFileLogger::WriteFormat(KRCSELogFolder(),KRCSELogFile(),EFileLoggingModeAppend,TRefByValue<const TDesC>(_L(AA)),BB,CC,DD); } |
|
82 #define RCSELOGTHREAD() { RFileLogger::Write(KRCSELogFolder(),KRCSELogFile(),EFileLoggingModeAppend, RThread().FullName() ); } |
|
83 |
|
84 #elif RCSE_LOGGING_METHOD == 2 // RDebug |
|
85 |
|
86 #define RCSELOGSTRING(AA) { RDebug::Print(_L(AA)); } |
|
87 #define RCSELOGSTRING2(AA,BB) { RDebug::Print(_L(AA),BB); } |
|
88 #define RCSELOGSTRING3(AA,BB,CC) { RDebug::Print(_L(AA),BB,CC); } |
|
89 #define RCSELOGSTRING4(AA,BB,CC,DD) { RDebug::Print(_L(AA),BB,CC,DD); } |
|
90 #define RCSELOGTHREAD() { RDebug::Print( RThread().FullName() ); } |
|
91 |
|
92 #else // RCSE_LOGGING_METHOD == 0 or invalid -> Disable loggings |
|
93 |
|
94 #define RCSELOGSTRING(AA) // Example: RCSELOGSTRING("Test"); |
|
95 #define RCSELOGSTRING2(AA,BB) // Example: RCSELOGSTRING("Test %d", aValue); |
|
96 #define RCSELOGSTRING3(AA,BB,CC) // Example: RCSELOGSTRING("Test %d %d", aValue1, aValue2); |
|
97 #define RCSELOGSTRING4(AA,BB,CC,DD) // Example: RCSELOGSTRING("Test %d %d %d", aValue1, aValue2, aValue3); |
|
98 #define RCSELOGTHREAD() |
|
99 |
|
100 #endif // RCSE_LOGGING_METHOD |
|
101 |
|
102 #endif // RCSELOGGER_H |