|
1 /* |
|
2 * Copyright (c) 2009-2010 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 * Debug definitions. |
|
16 * |
|
17 * |
|
18 */ |
|
19 |
|
20 |
|
21 #ifndef __SI_DEBUG_H__ |
|
22 #define __SI_DEBUG_H__ |
|
23 |
|
24 #include <e32debug.h> |
|
25 #include <flogger.h> |
|
26 #include <coeutils.h> |
|
27 |
|
28 #define INIT_DEBUG_LOG( aLogFile, aLogDir, aLogName ) \ |
|
29 { \ |
|
30 HBufC* buf = aLogFile.AllocLC(); \ |
|
31 TChar systemDrive; \ |
|
32 RFs::DriveToChar(RFs::GetSystemDrive(),systemDrive); \ |
|
33 buf->Des()[0] = systemDrive; \ |
|
34 ConeUtils::EnsurePathExistsL( *buf ); \ |
|
35 CleanupStack::PopAndDestroy(buf); \ |
|
36 iLog.Connect(); \ |
|
37 iLog.CreateLog( aLogDir, aLogName, EFileLoggingModeOverwrite); \ |
|
38 } |
|
39 |
|
40 #define CLOSE_DEBUG_LOG \ |
|
41 iLog.CloseLog(); \ |
|
42 iLog.Close(); |
|
43 |
|
44 #define INIT_OBJECT_DEBUG_LOG \ |
|
45 RFileLogger iLog; |
|
46 |
|
47 #if defined(DEBUG_ADM) || defined(_DEBUG) |
|
48 #ifdef USE_LOGFILE |
|
49 |
|
50 #define LOG( aMsg ) { _LIT(KMsg, aMsg); iLog.Write( KMsg ); RDebug::Print( KMsg ); } |
|
51 #define LOG2( aMsg, aParam1 ) { _LIT(KMsg, aMsg); iLog.WriteFormat( KMsg, aParam1 ); RDebug::Print( KMsg, aParam1 ); } |
|
52 #define LOG3( aMsg, aParam1, aParam2 ) { _LIT(KMsg, aMsg); iLog.WriteFormat( KMsg, aParam1, aParam2 ); RDebug::Print( KMsg, aParam1, aParam2 ); } |
|
53 #define LOG4( aMsg, aParam1, aParam2, aParam3 ) { _LIT(KMsg, aMsg); iLog.WriteFormat( KMsg, aParam1, aParam2, aParam3 ); RDebug::Print( KMsg, aParam1, aParam2, aParam3 ); } |
|
54 #define LOG5( aMsg, aParam1, aParam2, aParam3, aParam4 ) { _LIT(KMsg, aMsg); iLog.WriteFormat( KMsg, aParam1, aParam2, aParam3, aParam4 ); RDebug::Print( KMsg, aParam1, aParam2, aParam3, aParam4 ); } |
|
55 #define LOG6( aMsg, aParam1, aParam2, aParam3, aParam4, aParam5 ) { _LIT(KMsg, aMsg); iLog.WriteFormat( KMsg, aParam1, aParam2, aParam3, aParam4, aParam5 ); RDebug::Print( KMsg, aParam1, aParam2, aParam3, aParam4, aParam5 ); } |
|
56 #define LOG7( aMsg, aParam1, aParam2, aParam3, aParam4, aParam5, aParam6 ) { _LIT(KMsg, aMsg); iLog.WriteFormat( KMsg, aParam1, aParam2, aParam3, aParam4, aParam5, aParam6 ); RDebug::Print( KMsg, aParam1, aParam2, aParam3, aParam4, aParam5, aParam6 ); } |
|
57 #define LOG8( aMsg, aParam1, aParam2, aParam3, aParam4, aParam5, aParam6, aParam7 ) { _LIT(KMsg, aMsg); iLog.WriteFormat( KMsg, aParam1, aParam2, aParam3, aParam4, aParam5, aParam6, aParam7 ); RDebug::Print( KMsg, aParam1, aParam2, aParam3, aParam4, aParam5, aParam6, aParam7 ); } |
|
58 #define LOG8_2( aMsg, aParam1 ) { _LIT8(KMsg, aMsg); iLog.WriteFormat( KMsg, aParam1 ); RDebug::Print(_L("RDebug _L8() at line %d"), __LINE__); } |
|
59 #else |
|
60 |
|
61 #define LOG( aMsg ) { _LIT(KMsg, aMsg); RDebug::Print( KMsg ); } |
|
62 #define LOG2( aMsg, aParam1 ) { _LIT(KMsg, aMsg); RDebug::Print( KMsg, aParam1 ); } |
|
63 #define LOG3( aMsg, aParam1, aParam2 ) { _LIT(KMsg, aMsg); RDebug::Print( KMsg, aParam1, aParam2 ); } |
|
64 #define LOG4( aMsg, aParam1, aParam2, aParam3 ) { _LIT(KMsg, aMsg); RDebug::Print( KMsg, aParam1, aParam2, aParam3 ); } |
|
65 #define LOG5( aMsg, aParam1, aParam2, aParam3, aParam4 ) { _LIT(KMsg, aMsg); RDebug::Print( KMsg, aParam1, aParam2, aParam3, aParam4 ); } |
|
66 #define LOG6( aMsg, aParam1, aParam2, aParam3, aParam4, aParam5 ) { _LIT(KMsg, aMsg); RDebug::Print( KMsg, aParam1, aParam2, aParam3, aParam4, aParam5 ); } |
|
67 #define LOG7( aMsg, aParam1, aParam2, aParam3, aParam4, aParam5, aParam6 ) { _LIT(KMsg, aMsg); RDebug::Print( KMsg, aParam1, aParam2, aParam3, aParam4, aParam5, aParam6 ); } |
|
68 #define LOG8( aMsg, aParam1, aParam2, aParam3, aParam4, aParam5, aParam6, aParam7 ) { _LIT(KMsg, aMsg); RDebug::Print( KMsg, aParam1, aParam2, aParam3, aParam4, aParam5, aParam6, aParam7 ); } |
|
69 #define LOG8_2( aMsg, aParam1 ) { _LIT8(KMsg, aMsg); TBuf8<128> t; t.AppendFormat(KMsg, aParam1); RDebug::RawPrint(t); } |
|
70 #endif |
|
71 |
|
72 #define RLOG( aMsg ) { RDebug::Print ( aMsg ); } |
|
73 |
|
74 #else |
|
75 |
|
76 #define LOG( a ) |
|
77 #define LOG2( a, b ) |
|
78 #define LOG3( a, b, c ) |
|
79 #define LOG4( a, b, c, d ) |
|
80 #define LOG5( aMsg, aParam1, aParam2, aParam3, aParam4 ) |
|
81 #define LOG6( aMsg, aParam1, aParam2, aParam3, aParam4, aParam5 ) |
|
82 #define LOG7( aMsg, aParam1, aParam2, aParam3, aParam4, aParam5, aParam6 ) |
|
83 #define LOG8( aMsg, aParam1, aParam2, aParam3, aParam4, aParam5, aParam6, aParam7 ) |
|
84 #define LOG8_2( a, b ) |
|
85 #endif |
|
86 |
|
87 // Forced Logs - Always printed. |
|
88 #define FLOG( aMsg ) { _LIT(KMsg, aMsg); iLog.Write( KMsg ); RDebug::Print( KMsg ); } |
|
89 #define FLOG2( aMsg, aParam1 ) { _LIT(KMsg, aMsg); iLog.WriteFormat( KMsg, aParam1 ); RDebug::Print( KMsg, aParam1 ); } |
|
90 #define FLOG3( aMsg, aParam1, aParam2 ) { _LIT(KMsg, aMsg); iLog.WriteFormat( KMsg, aParam1, aParam2 ); RDebug::Print( KMsg, aParam1, aParam2 ); } |
|
91 |
|
92 #endif |