1 // Copyright (c) 2008-2010 Nokia Corporation and/or its subsidiary(-ies). |
1 // Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies). |
2 // All rights reserved. |
2 // All rights reserved. |
3 // This component and the accompanying materials are made available |
3 // This component and the accompanying materials are made available |
4 // under the terms of "Eclipse Public License v1.0" |
4 // under the terms of "Eclipse Public License v1.0" |
5 // which accompanies this distribution, and is available |
5 // which accompanies this distribution, and is available |
6 // at the URL "http://www.eclipse.org/legal/epl-v10.html". |
6 // at the URL "http://www.eclipse.org/legal/epl-v10.html". |
20 /** |
20 /** |
21 @file |
21 @file |
22 @internalComponent |
22 @internalComponent |
23 */ |
23 */ |
24 |
24 |
25 #include "OstTraceDefinitions.h" |
25 #include <ctsy/ltsy/ltsylogger.h> |
26 #ifdef OST_TRACE_COMPILER_IN_USE |
|
27 #include "ltsyloggerTraces.h" |
|
28 #endif |
|
29 |
26 |
30 #include <ctsy/ltsy/ltsylogger.h> |
27 #ifdef _DEBUG |
31 //#include <e32debug.h> |
28 #include <e32debug.h> |
32 |
29 #include <comms-infras/commsdebugutility.h> |
33 #if (OST_TRACE_CATEGORY & OST_TRACE_CATEGORY_DEBUG) |
|
34 |
30 |
35 const TInt KLineLength = 255; |
31 const TInt KLineLength = 255; |
36 |
32 |
37 EXPORT_C TLogEntryExit::TLogEntryExit(const TDesC8& aFnName, const TDesC8& aLayer) |
33 EXPORT_C TLogEntryExit::TLogEntryExit(const TDesC8& aFnName, const TDesC8& aLayer) |
38 /** |
34 /** |
39 Constructor: log the function name entry |
35 Constructor: log the function name entry |
40 */ |
36 */ |
41 :iFnName(aFnName), iLayer(aLayer), iErr(KErrNone) |
37 :iFnName(aFnName), iLayer(aLayer), iErr(KErrNone) |
42 { |
38 { |
43 OstTraceDefExt1(OST_TRACE_CATEGORY_DEBUG, TRACE_BORDER, TLOGENTRYEXIT_TLOGENTRYEXIT_1, "%s", iFnName); |
39 RFileLogger::WriteFormat(KTsySubSystem, iLayer, _L8(">>%S"), &iFnName); |
44 }; |
40 }; |
45 |
41 |
46 EXPORT_C TLogEntryExit::TLogEntryExit(const TDesC8& aFnName, const TDesC8& aLayer, TRefByValue<const TDesC8> aFmt, ...) |
42 EXPORT_C TLogEntryExit::TLogEntryExit(const TDesC8& aFnName, const TDesC8& aLayer, TRefByValue<const TDesC8> aFmt, ...) |
47 /** |
43 /** |
48 Write the function name entry plus plus 8 bits formated list |
44 Write the function name entry plus plus 8 bits formated list |
54 TBuf8<KLineLength> line; |
50 TBuf8<KLineLength> line; |
55 line.Append(_L8(">>")); |
51 line.Append(_L8(">>")); |
56 line.Append(iFnName); |
52 line.Append(iFnName); |
57 line.Append(' '); |
53 line.Append(' '); |
58 line.Append(aFmt); |
54 line.Append(aFmt); |
59 TBuf8<KLineLength> evaluatedLine; |
55 RFileLogger::WriteFormat(KTsySubSystem, iLayer, line, list); |
60 evaluatedLine.FormatList(line,list); |
|
61 OstTraceDefExt1(OST_TRACE_CATEGORY_DEBUG, TRACE_BORDER, TLOGENTRYEXIT_TLOGENTRYEXIT1_1, "%s", evaluatedLine); |
|
62 }; |
56 }; |
63 |
57 |
64 EXPORT_C TLogEntryExit::TLogEntryExit(const TDesC8& aFnName, const TDesC8& aLayer, TRefByValue<const TDesC16> aFmt, ...) |
58 EXPORT_C TLogEntryExit::TLogEntryExit(const TDesC8& aFnName, const TDesC8& aLayer, TRefByValue<const TDesC16> aFmt, ...) |
65 /** |
59 /** |
66 Write the function name entry plus 16 bits formated list |
60 Write the function name entry plus 16 bits formated list |
73 TBuf<KLineLength> line; |
67 TBuf<KLineLength> line; |
74 line.Copy(iFnName); |
68 line.Copy(iFnName); |
75 line.Insert(0,_L(">>")); |
69 line.Insert(0,_L(">>")); |
76 line.Append(' '); |
70 line.Append(' '); |
77 line.Append(aFmt); |
71 line.Append(aFmt); |
78 TBuf<KLineLength> evaluatedLine; |
72 RFileLogger::WriteFormat(KTsySubSystem, iLayer, line, list); |
79 evaluatedLine.FormatList(line,list); |
|
80 OstTraceDefExt1(OST_TRACE_CATEGORY_DEBUG, TRACE_BORDER, TLOGENTRYEXIT_TLOGENTRYEXIT2_1, "%S", evaluatedLine); |
|
81 }; |
73 }; |
82 |
74 |
83 EXPORT_C TLogEntryExit::~TLogEntryExit() |
75 EXPORT_C TLogEntryExit::~TLogEntryExit() |
84 /** |
76 /** |
85 Write the function name exit |
77 Write the function name exit |
86 */ |
78 */ |
87 { |
79 { |
88 if (iErr == KErrNone) |
80 if (iErr == KErrNone) |
89 { |
81 { |
90 OstTraceDefExt1(OST_TRACE_CATEGORY_DEBUG, TRACE_BORDER, TLOGENTRYEXIT_TLOGENTRYEXIT_DTOR_1, "%s",iFnName); |
82 RFileLogger::WriteFormat(KTsySubSystem, iLayer, _L8("<<%S"), &iFnName); |
91 } |
83 } |
92 else |
84 else |
93 { |
85 { |
94 OstTraceDefExt2(OST_TRACE_CATEGORY_DEBUG, TRACE_BORDER, TLOGENTRYEXIT_TLOGENTRYEXIT_DTOR_2, "%s [err=%d]",iFnName, iErr); |
86 RFileLogger::WriteFormat(KTsySubSystem, iLayer, _L8("<<%S [err=%d]"), &iFnName, iErr); |
95 } |
87 } |
96 }; |
88 }; |
97 |
89 |
98 #else // #ifdef _DEBUG |
90 #else // #ifdef _DEBUG |
99 |
91 |
101 EXPORT_C TLogEntryExit::TLogEntryExit(const TDesC8& /*aFnName*/, const TDesC8& /*aLayer*/){}; |
93 EXPORT_C TLogEntryExit::TLogEntryExit(const TDesC8& /*aFnName*/, const TDesC8& /*aLayer*/){}; |
102 EXPORT_C TLogEntryExit::TLogEntryExit(const TDesC8& /*aFnName*/, const TDesC8& /*aLayer*/, TRefByValue<const TDesC8> /*aFmt*/, ...){}; |
94 EXPORT_C TLogEntryExit::TLogEntryExit(const TDesC8& /*aFnName*/, const TDesC8& /*aLayer*/, TRefByValue<const TDesC8> /*aFmt*/, ...){}; |
103 EXPORT_C TLogEntryExit::TLogEntryExit(const TDesC8& /*aFnName*/, const TDesC8& /*aLayer*/, TRefByValue<const TDesC16> /*aFmt*/, ...){}; |
95 EXPORT_C TLogEntryExit::TLogEntryExit(const TDesC8& /*aFnName*/, const TDesC8& /*aLayer*/, TRefByValue<const TDesC16> /*aFmt*/, ...){}; |
104 EXPORT_C TLogEntryExit::~TLogEntryExit() {}; |
96 EXPORT_C TLogEntryExit::~TLogEntryExit() {}; |
105 |
97 |
106 #endif // #ifdef OST_TRACE_COMPILER_IN_USE |
98 #endif // #ifdef _DEBUG |