|
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 the License "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: |
|
15 * Declaration of class FavouritesLogger |
|
16 * |
|
17 * |
|
18 */ |
|
19 |
|
20 |
|
21 #ifndef FAVOURITES_LOGGER_H |
|
22 #define FAVOURITES_LOGGER_H |
|
23 |
|
24 // INCLUDES |
|
25 |
|
26 #include <e32std.h> |
|
27 #include <e32def.h> |
|
28 #include <flogger.h> |
|
29 |
|
30 #ifdef _DEBUG |
|
31 |
|
32 /// Defining this enables logging. Needs flogger.lib. |
|
33 #define __TEST_FAVOURITES_LOG |
|
34 |
|
35 #endif /* def _DEBUG */ |
|
36 |
|
37 #ifdef __TEST_FAVOURITES_LOG |
|
38 |
|
39 // CLASS DECLARATION |
|
40 |
|
41 /** |
|
42 * Logger class. |
|
43 */ |
|
44 NONSHARABLE_CLASS(FavouritesLogger) |
|
45 { |
|
46 public: // new methods |
|
47 |
|
48 /** |
|
49 * Write formatted log. |
|
50 * @param aFmt Format string. |
|
51 */ |
|
52 static void Write( TRefByValue<const TDesC16> aFmt, ... ); |
|
53 |
|
54 /** |
|
55 * Write formatted log. |
|
56 * @param aFmt Format string. |
|
57 * @param aList Variable argument list. |
|
58 */ |
|
59 static void Write( TRefByValue<const TDesC16> aFmt, VA_LIST& aList ); |
|
60 |
|
61 /** |
|
62 * Write formatted log. |
|
63 * @param aFmt Format string. |
|
64 */ |
|
65 static void Write( TRefByValue<const TDesC8> aFmt, ... ); |
|
66 |
|
67 /** |
|
68 * Write formatted log. |
|
69 * @param aFmt Format string. |
|
70 * @param aList Variable argument list. |
|
71 */ |
|
72 static void Write( TRefByValue<const TDesC8> aFmt, VA_LIST& aList ); |
|
73 |
|
74 /** |
|
75 * Write hex dump. |
|
76 * @param aHeader Header string. |
|
77 * @param aMargin Margin. |
|
78 * @param aPtr Data. |
|
79 * @param aLen Data length. |
|
80 */ |
|
81 static void HexDump |
|
82 ( |
|
83 const TText* aHeader, |
|
84 const TText* aMargin, |
|
85 const TUint8* aPtr, |
|
86 TInt aLen |
|
87 ); |
|
88 |
|
89 }; |
|
90 |
|
91 #endif /* def __TEST_FAVOURITES_LOG */ |
|
92 |
|
93 #ifdef __TEST_FAVOURITES_LOG |
|
94 |
|
95 /// Write formatted to log. |
|
96 #define FLOG( body ) FavouritesLogger::Write body |
|
97 /// Write hex dump. |
|
98 #define FDUMP( body ) FavouritesLogger::HexDump body |
|
99 /// Guard "log-only" argument name with this (expands to argument). |
|
100 #define LOG_ONLY( argName ) argName |
|
101 |
|
102 #else /* not defined __TEST_FAVOURITES_LOG */ |
|
103 |
|
104 /// Do nothing (log disabled). |
|
105 #define FLOG( body ) |
|
106 /// Do nothing (log disabled). |
|
107 #define FDUMP( body ) |
|
108 /// Guard "log-only" argument name with this (expands to nothing). |
|
109 #define LOG_ONLY( argName ) |
|
110 |
|
111 #endif /* def __TEST_FAVOURITES_LOG */ |
|
112 |
|
113 #ifdef _DEBUG |
|
114 |
|
115 /// Guard "debug-only" argument name with this (expands to argument). |
|
116 #define DEBUG_ONLY( argName ) argName |
|
117 |
|
118 #else /* not defined _DEBUG */ |
|
119 |
|
120 /// Guard "debug-only" argument name with this (expands to nothing). |
|
121 #define DEBUG_ONLY( argName ) |
|
122 |
|
123 #endif /* def _DEBUG */ |
|
124 |
|
125 #endif /* def FAVOURITES_LOGGER_H */ |
|
126 |
|
127 // End of File |