|
1 /* |
|
2 * Copyright (c) 2006 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: This is class is logging purposes. |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 |
|
20 |
|
21 |
|
22 #ifndef _PRESSETTINGSAPILOGGER_H |
|
23 #define _PRESSETTINGSAPILOGGER_H |
|
24 |
|
25 |
|
26 // logging is done only in debug |
|
27 #ifdef _DEBUG |
|
28 |
|
29 #include <flogger.h> |
|
30 |
|
31 //Logging constants |
|
32 _LIT(KLogDir, "pressettingsapi"); |
|
33 _LIT(KLogFile, "pressettingsapi.txt"); |
|
34 |
|
35 #define D_OPENG_LIT(s) _L(s) |
|
36 #define OPENG_DP OPENGDebugWriteFormat |
|
37 |
|
38 |
|
39 /** |
|
40 * Log file printing utility function |
|
41 * @since Series 60 3.0 |
|
42 */ |
|
43 inline void OPENGDebugWriteFormat( TRefByValue<const TDesC> aFmt,...) //lint !e960 |
|
44 { |
|
45 //Use RFileLogger to write log - no time and date |
|
46 RFileLogger logger; |
|
47 logger.Connect(); |
|
48 //use date, use time |
|
49 logger.SetDateAndTime( EFalse, ETrue ); |
|
50 logger.CreateLog( KLogDir, |
|
51 KLogFile, |
|
52 EFileLoggingModeAppend ); |
|
53 |
|
54 TBuf< 256 > buffer; |
|
55 |
|
56 { |
|
57 VA_LIST list; |
|
58 VA_START (list, aFmt); //lint !e960 |
|
59 TBuf< 300 > formatted; |
|
60 formatted.FormatList( aFmt, list ); |
|
61 buffer.Append( formatted.Left( buffer.MaxLength() - buffer.Length() ) ); |
|
62 } |
|
63 |
|
64 logger.Write( buffer ); |
|
65 logger.CloseLog(); |
|
66 logger.Close(); |
|
67 } |
|
68 |
|
69 |
|
70 #else // _DEBUG |
|
71 |
|
72 struct TOPENGEmptyDebugString { }; |
|
73 |
|
74 #define D_OPENG_LIT(s) TOPENGEmptyDebugString() |
|
75 |
|
76 /// Empty debug print function for release builds. |
|
77 inline void OPENG_DP(TOPENGEmptyDebugString) |
|
78 { |
|
79 } |
|
80 |
|
81 template<class T1> |
|
82 inline void OPENG_DP(TOPENGEmptyDebugString,T1) |
|
83 { |
|
84 } |
|
85 |
|
86 template<class T1,class T2> |
|
87 inline void OPENG_DP(TOPENGEmptyDebugString,T1,T2) |
|
88 { |
|
89 } |
|
90 |
|
91 template<class T1,class T2,class T3> |
|
92 inline void OPENG_DP(TOPENGEmptyDebugString,T1,T2,T3) |
|
93 { |
|
94 } |
|
95 |
|
96 template<class T1,class T2,class T3,class T4> |
|
97 inline void OPENG_DP(TOPENGEmptyDebugString,T1,T2,T3,T4) |
|
98 { |
|
99 } |
|
100 |
|
101 template<class T1,class T2,class T3,class T4,class T5> |
|
102 inline void OPENG_DP(TOPENGEmptyDebugString,T1,T2,T3,T4,T5) |
|
103 { |
|
104 } |
|
105 |
|
106 template<class T1,class T2,class T3,class T4,class T5,class T6> |
|
107 inline void OPENG_DP(TOPENGEmptyDebugString,T1,T2,T3,T4,T5,T6) |
|
108 { |
|
109 } |
|
110 |
|
111 template<class T1,class T2,class T3,class T4,class T5,class T6,class T7> |
|
112 inline void OPENG_DP(TOPENGEmptyDebugString,T1,T2,T3,T4,T5,T6,T7) |
|
113 { |
|
114 } |
|
115 |
|
116 template<class T1,class T2,class T3,class T4,class T5,class T6,class T7,class T8> |
|
117 inline void OPENG_DP(TOPENGEmptyDebugString,T1,T2,T3,T4,T5,T6,T7,T8) |
|
118 { |
|
119 } |
|
120 |
|
121 |
|
122 #endif // _DEBUG |
|
123 |
|
124 |
|
125 #endif // _PRESSETTINGSAPILOGGER_H |
|
126 |
|
127 // End of File |