67
|
1 |
/*
|
|
2 |
* Copyright (c) 2008 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: Debug print macros*
|
|
15 |
*/
|
|
16 |
|
|
17 |
|
|
18 |
// Version : %version: 1 %
|
|
19 |
|
|
20 |
#ifndef __MPXVIDEO_DEBUG_H__
|
|
21 |
#define __MPXVIDEO_DEBUG_H__
|
|
22 |
|
|
23 |
#include "stub/inc/cpitemdatahelper.h"
|
|
24 |
#include "stub/inc/cpsettingformentryitemdata.h"
|
|
25 |
#include "stub/inc/cmapplsettingsui.h"
|
|
26 |
#include "stub/inc/cmconnectionmethod_shim.h"
|
|
27 |
#include "stub/inc/cmmanager_shim.h"
|
|
28 |
#include "stub/inc/videosettingsgroup.h"
|
|
29 |
|
|
30 |
// INCLUDES
|
|
31 |
#include <e32std.h>
|
|
32 |
#include <e32svr.h>
|
|
33 |
#include <e32des16.h>
|
|
34 |
#include <e32property.h>
|
|
35 |
#include <flogger.h>
|
|
36 |
#include <e32def.h>
|
|
37 |
|
|
38 |
|
|
39 |
|
|
40 |
// #define _MPX_FILE_LOGGING_
|
|
41 |
|
|
42 |
#ifdef _DEBUG
|
|
43 |
#define FU_DEBUG RDebug::Print
|
|
44 |
#else
|
|
45 |
#ifdef _MPX_FILE_LOGGING_
|
|
46 |
#define FU_DEBUG MPXDebug::FileLog
|
|
47 |
#else
|
|
48 |
#define FU_DEBUG
|
|
49 |
#endif
|
|
50 |
#endif
|
|
51 |
|
|
52 |
|
|
53 |
class MPXDebug
|
|
54 |
{
|
|
55 |
public:
|
|
56 |
inline static void FileLog( TRefByValue<const TDesC16> aFmt, ... )
|
|
57 |
{
|
|
58 |
VA_LIST list;
|
|
59 |
VA_START(list,aFmt);
|
|
60 |
RFileLogger::WriteFormat( _L("Fusion"),
|
|
61 |
_L("fusion.log"),
|
|
62 |
EFileLoggingModeAppend,
|
|
63 |
aFmt,
|
|
64 |
list );
|
|
65 |
}
|
|
66 |
};
|
|
67 |
|
|
68 |
|
|
69 |
|
|
70 |
// MACROS
|
|
71 |
#ifdef _DEBUG
|
|
72 |
#define MPX_DEBUG TFusionLog::FusionLog
|
|
73 |
#define MPX_ENTER_EXIT TEnterExitLog _s
|
|
74 |
#else
|
|
75 |
#define MPX_DEBUG
|
|
76 |
#define MPX_ENTER_EXIT
|
|
77 |
#endif
|
|
78 |
|
|
79 |
|
|
80 |
class TFusionLog : public TDes16Overflow
|
|
81 |
{
|
|
82 |
public:
|
|
83 |
|
|
84 |
inline static void FusionLog( TRefByValue<const TDesC16> aFmt, ... )
|
|
85 |
{
|
|
86 |
TBuf< 496 > buffer;
|
|
87 |
|
|
88 |
VA_LIST list;
|
|
89 |
VA_START( list, aFmt );
|
|
90 |
buffer.AppendFormatList( aFmt, list );
|
|
91 |
VA_END(list);
|
|
92 |
|
|
93 |
FU_DEBUG(_L("#Fu# %S"), &buffer );
|
|
94 |
}
|
|
95 |
};
|
|
96 |
|
|
97 |
class TEnterExitLog : public TDes16Overflow
|
|
98 |
{
|
|
99 |
public:
|
|
100 |
|
|
101 |
void Overflow(TDes16& /*aDes*/)
|
|
102 |
{
|
|
103 |
FU_DEBUG(_L("%S Logging Overflow"), &iFunctionName);
|
|
104 |
}
|
|
105 |
|
|
106 |
TEnterExitLog( TRefByValue<const TDesC> aFunctionName,
|
|
107 |
TRefByValue<const TDesC> aFmt, ... )
|
|
108 |
{
|
|
109 |
iFunctionName = HBufC::New( TDesC(aFunctionName).Length() );
|
|
110 |
|
|
111 |
if ( iFunctionName )
|
|
112 |
{
|
|
113 |
iFunctionName->Des().Copy(aFunctionName);
|
|
114 |
}
|
|
115 |
|
|
116 |
TBuf< 496 > buffer;
|
|
117 |
|
|
118 |
VA_LIST list;
|
|
119 |
VA_START( list, aFmt );
|
|
120 |
buffer.AppendFormatList( aFmt, list, this );
|
|
121 |
VA_END(list);
|
|
122 |
|
|
123 |
FU_DEBUG(_L("#Fu# --> %S %S"), iFunctionName, &buffer );
|
|
124 |
}
|
|
125 |
|
|
126 |
TEnterExitLog( TRefByValue<const TDesC> aFunctionName )
|
|
127 |
{
|
|
128 |
iFunctionName = HBufC::New( TDesC(aFunctionName).Length() );
|
|
129 |
|
|
130 |
if ( iFunctionName )
|
|
131 |
{
|
|
132 |
iFunctionName->Des().Copy(aFunctionName);
|
|
133 |
}
|
|
134 |
|
|
135 |
FU_DEBUG(_L("#Fu# --> %S"), iFunctionName );
|
|
136 |
}
|
|
137 |
|
|
138 |
~TEnterExitLog()
|
|
139 |
{
|
|
140 |
FU_DEBUG(_L("#Fu# <-- %S"), iFunctionName );
|
|
141 |
delete iFunctionName;
|
|
142 |
}
|
|
143 |
|
|
144 |
private:
|
|
145 |
HBufC* iFunctionName;
|
|
146 |
};
|
|
147 |
|
|
148 |
_LIT(_KMPXErrorInfo, "#Fu# MPXVideo Error : error %d file %s line %d");
|
|
149 |
|
|
150 |
#define MPX_S(a) _S(a)
|
|
151 |
|
|
152 |
#define MPX_ERROR_LOG(aErr) \
|
|
153 |
{\
|
|
154 |
if (aErr) \
|
|
155 |
FU_DEBUG(_KMPXErrorInfo, aErr, MPX_S(__FILE__), __LINE__);\
|
|
156 |
}
|
|
157 |
|
|
158 |
#ifdef _DEBUG
|
|
159 |
#define MPX_TRAP(_r, _s) TRAP(_r,_s);MPX_ERROR_LOG(_r);
|
|
160 |
#define MPX_TRAPD(_r, _s) TRAPD(_r,_s);MPX_ERROR_LOG(_r);
|
|
161 |
#else // _DEBUG
|
|
162 |
#define MPX_TRAP(_r, _s) TRAP(_r,_s);(_r=_r);
|
|
163 |
#define MPX_TRAPD(_r, _s) TRAPD(_r,_s);(_r=_r);
|
|
164 |
#endif // _DEBUG
|
|
165 |
|
|
166 |
#endif // __MPXVIDEO_DEBUG_H__
|
|
167 |
|
|
168 |
// End of File
|