38 #ifdef _DEBUG |
38 #ifdef _DEBUG |
39 #define FU_DEBUG RDebug::Print |
39 #define FU_DEBUG RDebug::Print |
40 #else |
40 #else |
41 #ifdef _MPX_FILE_LOGGING_ |
41 #ifdef _MPX_FILE_LOGGING_ |
42 #define FU_DEBUG MPXDebug::FileLog |
42 #define FU_DEBUG MPXDebug::FileLog |
43 #else |
43 #else |
44 #define FU_DEBUG |
44 #define FU_DEBUG |
45 #endif |
45 #endif |
46 #endif |
46 #endif |
47 |
47 |
48 |
48 |
49 class MPXDebug |
49 class MPXDebug |
50 { |
50 { |
51 public: |
51 public: |
52 inline static void FileLog( TRefByValue<const TDesC16> aFmt, ... ) |
52 inline static void FileLog( TRefByValue<const TDesC16> aFmt, ... ) |
53 { |
53 { |
54 VA_LIST list; |
54 VA_LIST list; |
55 VA_START(list,aFmt); |
55 VA_START(list,aFmt); |
56 RFileLogger::WriteFormat( _L("Fusion"), |
56 RFileLogger::WriteFormat( _L("Fusion"), |
57 _L("fusion.log"), |
57 _L("fusion.log"), |
58 EFileLoggingModeAppend, |
58 EFileLoggingModeAppend, |
59 aFmt, |
59 aFmt, |
60 list ); |
60 list ); |
61 } |
61 } |
74 |
74 |
75 |
75 |
76 class TFusionLog : public TDes16Overflow |
76 class TFusionLog : public TDes16Overflow |
77 { |
77 { |
78 public: |
78 public: |
79 |
79 |
80 inline static void FusionLog( TRefByValue<const TDesC16> aFmt, ... ) |
80 inline static void FusionLog( TRefByValue<const TDesC16> aFmt, ... ) |
81 { |
81 { |
82 TBuf< 496 > buffer; |
82 TBuf< 512 > buffer; |
83 |
83 |
84 VA_LIST list; |
84 VA_LIST list; |
85 VA_START( list, aFmt ); |
85 VA_START( list, aFmt ); |
86 buffer.AppendFormatList( aFmt, list ); |
86 buffer.AppendFormatList( aFmt, list ); |
87 VA_END(list); |
87 VA_END(list); |
88 |
88 |
89 FU_DEBUG(_L("#Fu# %S"), &buffer ); |
89 FU_DEBUG(_L("#Fu# %S"), &buffer ); |
90 } |
90 } |
91 }; |
91 }; |
92 |
92 |
93 class TEnterExitLog : public TDes16Overflow |
93 class TEnterExitLog : public TDes16Overflow |
94 { |
94 { |
95 public: |
95 public: |
96 |
96 |
97 void Overflow(TDes16& /*aDes*/) |
97 void Overflow(TDes16& /*aDes*/) |
98 { |
98 { |
99 FU_DEBUG(_L("%S Logging Overflow"), &iFunctionName); |
99 FU_DEBUG(_L("%S Logging Overflow"), &iFunctionName); |
100 } |
100 } |
101 |
101 |
102 TEnterExitLog( TRefByValue<const TDesC> aFunctionName, |
102 TEnterExitLog( TRefByValue<const TDesC> aFunctionName, |
103 TRefByValue<const TDesC> aFmt, ... ) |
103 TRefByValue<const TDesC> aFmt, ... ) |
104 { |
104 { |
105 iFunctionName = HBufC::New( TDesC(aFunctionName).Length() ); |
105 iFunctionName = HBufC::New( TDesC(aFunctionName).Length() ); |
106 |
106 |
107 if ( iFunctionName ) |
107 if ( iFunctionName ) |
108 { |
108 { |
109 iFunctionName->Des().Copy(aFunctionName); |
109 iFunctionName->Des().Copy(aFunctionName); |
110 } |
110 } |
111 |
111 |
112 TBuf< 496 > buffer; |
112 TBuf< 512 > buffer; |
113 |
113 |
114 VA_LIST list; |
114 VA_LIST list; |
115 VA_START( list, aFmt ); |
115 VA_START( list, aFmt ); |
116 buffer.AppendFormatList( aFmt, list, this ); |
116 buffer.AppendFormatList( aFmt, list, this ); |
117 VA_END(list); |
117 VA_END(list); |
118 |
118 |
119 FU_DEBUG(_L("#Fu# --> %S %S"), iFunctionName, &buffer ); |
119 FU_DEBUG(_L("#Fu# --> %S %S"), iFunctionName, &buffer ); |
120 } |
120 } |
121 |
121 |
122 TEnterExitLog( TRefByValue<const TDesC> aFunctionName ) |
122 TEnterExitLog( TRefByValue<const TDesC> aFunctionName ) |
123 { |
123 { |
124 iFunctionName = HBufC::New( TDesC(aFunctionName).Length() ); |
124 iFunctionName = HBufC::New( TDesC(aFunctionName).Length() ); |
125 |
125 |
126 if ( iFunctionName ) |
126 if ( iFunctionName ) |
127 { |
127 { |
128 iFunctionName->Des().Copy(aFunctionName); |
128 iFunctionName->Des().Copy(aFunctionName); |
129 } |
129 } |
130 |
130 |
131 FU_DEBUG(_L("#Fu# --> %S"), iFunctionName ); |
131 FU_DEBUG(_L("#Fu# --> %S"), iFunctionName ); |
132 } |
132 } |
133 |
133 |
134 ~TEnterExitLog() |
134 ~TEnterExitLog() |
135 { |
135 { |
136 FU_DEBUG(_L("#Fu# <-- %S"), iFunctionName ); |
136 FU_DEBUG(_L("#Fu# <-- %S"), iFunctionName ); |
137 delete iFunctionName; |
137 delete iFunctionName; |
138 } |
138 } |
139 |
139 |
140 private: |
140 private: |
141 HBufC* iFunctionName; |
141 HBufC* iFunctionName; |
142 }; |
142 }; |
143 |
143 |
144 _LIT(_KMPXErrorInfo, "#Fu# MPXVideo Error : error %d file %s line %d"); |
144 _LIT(_KMPXErrorInfo, "#Fu# MPXVideo Error : error %d file %s line %d"); |