|
1 /** |
|
2 * Copyright (c) 2004-2009 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: |
|
15 * Logging utilities |
|
16 * |
|
17 * |
|
18 */ |
|
19 |
|
20 |
|
21 |
|
22 /** |
|
23 @file |
|
24 */ |
|
25 |
|
26 #ifndef __SBLOG_H__ |
|
27 #define __SBLOG_H__ |
|
28 |
|
29 #include <flogger.h> |
|
30 #include <e32debug.h> |
|
31 |
|
32 /** |
|
33 @defgroup Log Log |
|
34 |
|
35 This module implements logging utilities. Information is currently |
|
36 logged via flogger, but this can be easily changed as logging is |
|
37 hidden by global macros. |
|
38 |
|
39 A nested namespace, log, contains the class and global function that |
|
40 performs the logging operations: TLog, OpenLog(), CloseLog() and TLog |
|
41 operator() - which accepts a variable number of arguments. There is |
|
42 macro for each of these functions. |
|
43 |
|
44 OpenLog() and CloseLog() must be called only once and this is done by |
|
45 MainL(). |
|
46 */ |
|
47 |
|
48 namespace conn |
|
49 { |
|
50 |
|
51 /** LOG CONTROL MACROS */ |
|
52 |
|
53 /** @{ */ |
|
54 |
|
55 #if (defined(SBE_LOGGING_DEBUG_ONLY) && defined(_DEBUG)) || defined(SBE_LOGGING_DEBUG_AND_RELEASE) |
|
56 |
|
57 #define SBE_LOGGING_ENABLED |
|
58 |
|
59 namespace securebackuplog |
|
60 /** |
|
61 @ingroup Log |
|
62 This namespace hides the internal of logging from the rest of the system. |
|
63 */ |
|
64 { |
|
65 void __LogRaw( TDes& aData ); |
|
66 void __Log(TRefByValue<const TDesC> aFmt,...); |
|
67 void __DebugDump( const TDesC& aFormat, const TUint8* aAddress, TInt aLength ); |
|
68 }//securebackuplog |
|
69 |
|
70 /** Logs a message */ |
|
71 #define __LOG(TXT) { _LIT(__KText,TXT); securebackuplog::__Log(__KText); } |
|
72 |
|
73 /** Logs a message plus an additional value. The text must |
|
74 contain an appropriate printf alike indication, e.g. %d if the additional |
|
75 value is an integer. */ |
|
76 #define __LOG1(TXT, A) { _LIT(__KText,TXT); securebackuplog::__Log(__KText, A); } |
|
77 #define __LOG2(TXT, A, B) { _LIT(__KText,TXT); securebackuplog::__Log(__KText, A, B); } |
|
78 #define __LOG3(TXT, A, B, C ) { _LIT(__KText,TXT); securebackuplog::__Log(__KText, A, B, C); } |
|
79 #define __LOG4(TXT, A, B, C, D ) { _LIT(__KText,TXT); securebackuplog::__Log(__KText, A, B, C, D); } |
|
80 #define __LOG5(TXT, A, B, C, D, E ) { _LIT(__KText,TXT); securebackuplog::__Log(__KText, A, B, C, D, E); } |
|
81 #define __LOG6(TXT, A, B, C, D, E, F ) { _LIT(__KText,TXT); securebackuplog::__Log(__KText, A, B, C, D, E, F); } |
|
82 |
|
83 /** Logs data as ascii text (hex encoded) */ |
|
84 #define __LOGDATA(TXT, DATAPOINTER, LEN) { _LIT(__KText,TXT); securebackuplog::__DebugDump(__KText, DATAPOINTER, LEN); } |
|
85 |
|
86 #else |
|
87 |
|
88 #define __LOG(TXT) |
|
89 #define __LOG1(TXT, A) |
|
90 #define __LOG2(TXT, A, B) |
|
91 #define __LOG3(TXT, A, B, C ) |
|
92 #define __LOG4(TXT, A, B, C, D ) |
|
93 #define __LOG5(TXT, A, B, C, D, E ) |
|
94 #define __LOG6(TXT, A, B, C, D, E, F ) |
|
95 #define __LOGDATA(TXT, DATAPOINTER, LEN) |
|
96 |
|
97 #endif |
|
98 |
|
99 /** @} */ |
|
100 |
|
101 }//conn |
|
102 |
|
103 #endif //__SBLOG_H__ |