|
1 /* |
|
2 * Copyright (c) 2002-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: Central place for debug-type macros |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 |
|
20 |
|
21 |
|
22 |
|
23 |
|
24 |
|
25 |
|
26 |
|
27 |
|
28 #ifndef SEN_DEBUG_H |
|
29 #define SEN_DEBUG_H |
|
30 |
|
31 // Note that _DEBUG is automatically defined for debug builds |
|
32 |
|
33 /** |
|
34 * To enable file logging: please comment following #ifdef line and |
|
35 * uncomment #ifdef TRUE |
|
36 */ |
|
37 #ifdef _DEBUG |
|
38 |
|
39 //#ifdef TRUE // to enable logging & debug in all builds |
|
40 //#ifndef TRUE // to disable logging & debug in all builds |
|
41 |
|
42 // INCLUDES |
|
43 #include <e32svr.h> |
|
44 #include <flogger.h> |
|
45 |
|
46 // MACROS |
|
47 #define _SENDEBUG 1 |
|
48 #define SENDEBUG(parameters) RDebug::Print parameters |
|
49 #define SENDEBUG_L(string) RDebug::Print(_L(string)) // single param |
|
50 |
|
51 #define LOG_CONNECT Log()->Connect() |
|
52 #define LOG_CREATELOG(parameters) Log()->CreateLog parameters |
|
53 #define LOG_WRITE(parameters) Log()->Write parameters |
|
54 #define LOG_WRITE_L(string) Log()->Write(_L(string)) // single param |
|
55 #define LOG_WRITEFORMAT(parameters) Log()->WriteFormat parameters |
|
56 #define LOG_CLOSELOG Log()->CloseLog() |
|
57 #define LOG_CLOSE Log()->Close() |
|
58 |
|
59 |
|
60 //#define LOG_WRITEALL(parameters) Log()->Write parameters |
|
61 |
|
62 #define LOG_WRITEALL(parameters) \ |
|
63 { \ |
|
64 TInt ___iZen___ = 0; \ |
|
65 TInt ___amountZen___ = 100; \ |
|
66 while(___iZen___<(parameters).Length()) \ |
|
67 { \ |
|
68 if(( (parameters).Length()-___iZen___) < 100) \ |
|
69 ___amountZen___ = (parameters).Length()-___iZen___; \ |
|
70 Log()->Write((parameters).Mid(___iZen___,___amountZen___)); \ |
|
71 ___iZen___+=100; \ |
|
72 } \ |
|
73 } |
|
74 |
|
75 |
|
76 #define FILELOG(dir, file, string) RFileLogger::Write(dir, file, EFileLoggingModeOverwriteRaw, string); |
|
77 #define FILELOGAPPEND(dir, file, string) RFileLogger::Write(dir, file, EFileLoggingModeAppendRaw, string); |
|
78 |
|
79 #define FILELOGALL(dir, file, longstring) \ |
|
80 { \ |
|
81 TInt ___iZen2___ = 0; \ |
|
82 TInt ___amountZen2___ = 100; \ |
|
83 FILELOG(dir, file, KNullDesC8()); \ |
|
84 while(___iZen2___<longstring.Length()) \ |
|
85 { \ |
|
86 if(( longstring.Length()-___iZen2___) < 100) \ |
|
87 ___amountZen2___ = longstring.Length()-___iZen2___; \ |
|
88 if(___iZen2___==0) FILELOG(dir, file, longstring.Mid(___iZen2___,___amountZen2___)) \ |
|
89 else FILELOGAPPEND(dir, file, longstring.Mid(___iZen2___,___amountZen2___)) \ |
|
90 ___iZen2___+=100; \ |
|
91 } \ |
|
92 } |
|
93 #else |
|
94 |
|
95 #define SENDEBUG(parameters) |
|
96 #define SENDEBUG_L(string) |
|
97 |
|
98 #define LOG_CONNECT |
|
99 #define LOG_CREATELOG(parameters) |
|
100 #define LOG_WRITE(parameters) |
|
101 #define LOG_WRITE_L(string) |
|
102 #define LOG_WRITEFORMAT(parameters) |
|
103 #define LOG_CLOSELOG |
|
104 #define LOG_CLOSE |
|
105 #define LOG_WRITEALL(parameters) |
|
106 |
|
107 #define FILELOG(dir, file, string) |
|
108 #define FILELOGAPPEND(dir, file, string) |
|
109 #define FILELOGALL(dir, file, parameters) |
|
110 |
|
111 #endif // _DEBUG |
|
112 |
|
113 #endif // SEN_DEBUG_H |
|
114 |
|
115 // End of File |