|
1 /* |
|
2 * Copyright (c) 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: Log functions used by the Camese subsystem |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 #ifndef CAMESELOG_H |
|
20 #define CAMESELOG_H |
|
21 |
|
22 #if defined (_DEBUG) |
|
23 |
|
24 // INCLUDES |
|
25 #include <flogger.h> |
|
26 |
|
27 // CONSTANTS |
|
28 // MUST DEFINE THE FOLLOWING 2 CONSTANTS |
|
29 _LIT(KCameseLogFolder,"camese"); |
|
30 _LIT(KCameseLogFile,"camese.txt"); |
|
31 |
|
32 /** |
|
33 * Logging class |
|
34 * This class allows debugging messages to be logged to file or RDebug port. |
|
35 * @since 3.1 |
|
36 */ |
|
37 NONSHARABLE_CLASS(CameseLog) |
|
38 { |
|
39 public: |
|
40 /** |
|
41 * Write to the log |
|
42 * @param aFmt string |
|
43 */ |
|
44 inline static void Printf1(const TDesC& aFmt); |
|
45 |
|
46 /** |
|
47 * Write a mulitple argument list to the log |
|
48 * @param aFmt format string |
|
49 */ |
|
50 inline static void Printf(TRefByValue<const TDesC> aFmt, ...); |
|
51 |
|
52 /** |
|
53 * Write to the log |
|
54 * @param aFmt string |
|
55 */ |
|
56 inline static void Printf1(const TDesC8& aFmt); |
|
57 |
|
58 /** |
|
59 * Write a mulitple argument list to the log |
|
60 * @param aFmt format string |
|
61 */ |
|
62 inline static void Printf(TRefByValue<const TDesC8> aFmt, ...); |
|
63 |
|
64 /** |
|
65 * Hex dump to the log |
|
66 * @param aFmt format string |
|
67 */ |
|
68 inline static void HexDump(const TText* aHeader, const TText* aMargin, |
|
69 const TUint8* aPtr, TInt aLen); |
|
70 }; |
|
71 |
|
72 // MACROS |
|
73 #define CAMESE_LOG_TDES(fmt) CameseLog::Printf1(fmt) |
|
74 #define CAMESE_LOG(fmt) CameseLog::Printf1(_L(fmt)) |
|
75 #define CAMESE_LOG1(fmt,v1) CameseLog::Printf(_L(fmt),v1) |
|
76 #define CAMESE_LOG2(fmt,v1,v2) CameseLog::Printf(_L(fmt),v1,v2) |
|
77 #define CAMESE_LOG3(fmt,v1,v2,v3) CameseLog::Printf(_L(fmt),v1,v2,v3) |
|
78 #define CAMESE_HEX_DUMP(h, m, p, l) CameseLog::HexDump(h, m, p, l) |
|
79 #define CAMESE_LOG8(fmt) CameseLog::Printf1(_L8(fmt)) |
|
80 #define CAMESE_LOG8_1(fmt,v1) CameseLog::Printf(_L8(fmt),v1) |
|
81 #define CAMESE_LOG8_2(fmt,v1,v2) CameseLog::Printf(_L8(fmt),v1,v2) |
|
82 #define CAMESE_LOG8_3(fmt,v1,v2,v3) CameseLog::Printf(_L8(fmt),v1,v2,v3) |
|
83 |
|
84 /** |
|
85 * Descriptor Overflow Handler for logging. |
|
86 * @since 3.1 |
|
87 */ |
|
88 NONSHARABLE_CLASS(TLogOverflowHandler) : public TDesOverflow |
|
89 { |
|
90 public: |
|
91 inline virtual void Overflow(TDes16 &aDes); |
|
92 }; |
|
93 |
|
94 /** |
|
95 * Descriptor Overflow Handler for logging (8bit). |
|
96 * @since 3.1 |
|
97 */ |
|
98 NONSHARABLE_CLASS(TLogOverflowHandler8) : public TDes8Overflow |
|
99 { |
|
100 public: |
|
101 inline virtual void Overflow(TDes8 &aDes); |
|
102 }; |
|
103 |
|
104 #include "cameselog.inl" |
|
105 |
|
106 #else |
|
107 |
|
108 #define CAMESE_LOG_TDES(fmt) |
|
109 #define CAMESE_LOG(fmt) |
|
110 #define CAMESE_LOG1(fmt,v1) |
|
111 #define CAMESE_LOG2(fmt,v1,v2) |
|
112 #define CAMESE_LOG3(fmt,v1,v2,v3) |
|
113 #define CAMESE_HEX_DUMP(h, m, p, l) |
|
114 #define CAMESE_LOG8(fmt) |
|
115 #define CAMESE_LOG8_1(fmt,v1) |
|
116 #define CAMESE_LOG8_2(fmt,v1,v2) |
|
117 #define CAMESE_LOG8_3(fmt,v1,v2,v3) |
|
118 |
|
119 #endif |
|
120 #endif // CAMESELOG_H |
|
121 |
|
122 // End of File |
|
123 |