1 /* |
|
2 * Copyright (c) 2005 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: Debug logging functionality. |
|
15 * |
|
16 */ |
|
17 |
|
18 #ifndef __DEVENCUI_LOG_H__ |
|
19 #define __DEVENCUI_LOG_H__ |
|
20 |
|
21 #include "DevEncUiConfig.hrh" |
|
22 |
|
23 #if defined( _DEBUG ) && defined ( DEVENCUI_LOG ) |
|
24 |
|
25 #include <e32base.h> |
|
26 #include <e32cmn.h> |
|
27 #include <e32debug.h> |
|
28 |
|
29 class CFileLog : public CBase |
|
30 { |
|
31 public: |
|
32 static void Printf( TRefByValue<const TDesC> aFmt, ... ); |
|
33 }; |
|
34 |
|
35 // Debug trace to stdout |
|
36 #define DLOG( aText ) \ |
|
37 { \ |
|
38 _LIT( KText, aText ); \ |
|
39 RDebug::Print( KText ); \ |
|
40 } |
|
41 |
|
42 // Debug trace to stdout |
|
43 #define DLOG2( aText, aParam ) \ |
|
44 { \ |
|
45 _LIT( KText, aText ); \ |
|
46 RDebug::Print( KText, aParam ); \ |
|
47 } |
|
48 |
|
49 // Debug trace to stdout |
|
50 #define DLOG3( aText, aParam1, aParam2 ) \ |
|
51 { \ |
|
52 _LIT( KText, aText ); \ |
|
53 RDebug::Print( KText, aParam1, aParam2 ); \ |
|
54 } |
|
55 |
|
56 // Debug trace to file |
|
57 #define FLOG( aText ) \ |
|
58 { \ |
|
59 _LIT( KLogText, aText ); \ |
|
60 CFileLog::Printf( KLogText ); \ |
|
61 } |
|
62 |
|
63 // Debug trace to file |
|
64 #define FLOG2( aText, b ) \ |
|
65 { \ |
|
66 _LIT( KLogText, aText ); \ |
|
67 CFileLog::Printf( KLogText, b ); \ |
|
68 } |
|
69 |
|
70 // Debug trace to file |
|
71 #define FLOG3( aText, b, c ) \ |
|
72 { \ |
|
73 _LIT( KLogText, aText ); \ |
|
74 CFileLog::Printf( KLogText, b, c ); \ |
|
75 } |
|
76 |
|
77 // Debug trace to stdout and file |
|
78 #define DFLOG( aText ) \ |
|
79 { \ |
|
80 DLOG( aText ); \ |
|
81 FLOG( aText ); \ |
|
82 } |
|
83 |
|
84 // Debug trace to stdout and file |
|
85 #define DFLOG2( aText, aParam ) \ |
|
86 { \ |
|
87 DLOG2( aText, aParam ); \ |
|
88 FLOG2( aText, aParam ); \ |
|
89 } |
|
90 |
|
91 // Debug trace to stdout and file |
|
92 #define DFLOG3( aText, aParam1, aParam2 ) \ |
|
93 { \ |
|
94 DLOG3( aText, aParam1, aParam2 ); \ |
|
95 FLOG3( aText, aParam1, aParam2 ); \ |
|
96 } |
|
97 |
|
98 // Debug trace a string literal to file |
|
99 #define FLOGBUF( aText ) \ |
|
100 { \ |
|
101 CFileLog::Printf( aText ); \ |
|
102 } |
|
103 |
|
104 #else // _DEBUG not defined, no logging code will be included at all |
|
105 |
|
106 #define DLOG( a ) |
|
107 #define DLOG2( a, b ) |
|
108 #define DLOG3( a, b, c ) |
|
109 #define FLOG( a ) |
|
110 #define FLOG2( a, b ) |
|
111 #define FLOG3( a, b, c ) |
|
112 #define DFLOG( a ) |
|
113 #define DFLOG2( a, b ) |
|
114 #define DFLOG3( a, b, c ) |
|
115 #define FLOGBUF( a ) |
|
116 |
|
117 #endif // _DEBUG |
|
118 |
|
119 #endif // __DEVENCUI_LOG_H__ |
|
120 |
|
121 // End of File |
|
122 |
|