1 // Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies). |
1 // Copyright (c) 2008-2010 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" |
|
26 #ifdef OST_TRACE_COMPILER_IN_USE |
|
27 #include "ltsyloggerTraces.h" |
|
28 #endif |
|
29 |
25 #include <ctsy/ltsy/ltsylogger.h> |
30 #include <ctsy/ltsy/ltsylogger.h> |
|
31 //#include <e32debug.h> |
26 |
32 |
27 #ifdef _DEBUG |
33 #if (OST_TRACE_CATEGORY & OST_TRACE_CATEGORY_DEBUG) |
28 #include <e32debug.h> |
|
29 #include <comms-infras/commsdebugutility.h> |
|
30 |
34 |
31 const TInt KLineLength = 255; |
35 const TInt KLineLength = 255; |
32 |
36 |
33 EXPORT_C TLogEntryExit::TLogEntryExit(const TDesC8& aFnName, const TDesC8& aLayer) |
37 EXPORT_C TLogEntryExit::TLogEntryExit(const TDesC8& aFnName, const TDesC8& aLayer) |
34 /** |
38 /** |
35 Constructor: log the function name entry |
39 Constructor: log the function name entry |
36 */ |
40 */ |
37 :iFnName(aFnName), iLayer(aLayer), iErr(KErrNone) |
41 :iFnName(aFnName), iLayer(aLayer), iErr(KErrNone) |
38 { |
42 { |
39 RFileLogger::WriteFormat(KTsySubSystem, iLayer, _L8(">>%S"), &iFnName); |
43 OstTraceDefExt1(OST_TRACE_CATEGORY_DEBUG, TRACE_BORDER, TLOGENTRYEXIT_TLOGENTRYEXIT_1, "%s", iFnName); |
40 }; |
44 }; |
41 |
45 |
42 EXPORT_C TLogEntryExit::TLogEntryExit(const TDesC8& aFnName, const TDesC8& aLayer, TRefByValue<const TDesC8> aFmt, ...) |
46 EXPORT_C TLogEntryExit::TLogEntryExit(const TDesC8& aFnName, const TDesC8& aLayer, TRefByValue<const TDesC8> aFmt, ...) |
43 /** |
47 /** |
44 Write the function name entry plus plus 8 bits formated list |
48 Write the function name entry plus plus 8 bits formated list |
50 TBuf8<KLineLength> line; |
54 TBuf8<KLineLength> line; |
51 line.Append(_L8(">>")); |
55 line.Append(_L8(">>")); |
52 line.Append(iFnName); |
56 line.Append(iFnName); |
53 line.Append(' '); |
57 line.Append(' '); |
54 line.Append(aFmt); |
58 line.Append(aFmt); |
55 RFileLogger::WriteFormat(KTsySubSystem, iLayer, line, list); |
59 TBuf8<KLineLength> evaluatedLine; |
|
60 evaluatedLine.FormatList(line,list); |
|
61 OstTraceDefExt1(OST_TRACE_CATEGORY_DEBUG, TRACE_BORDER, TLOGENTRYEXIT_TLOGENTRYEXIT1_1, "%s", evaluatedLine); |
56 }; |
62 }; |
57 |
63 |
58 EXPORT_C TLogEntryExit::TLogEntryExit(const TDesC8& aFnName, const TDesC8& aLayer, TRefByValue<const TDesC16> aFmt, ...) |
64 EXPORT_C TLogEntryExit::TLogEntryExit(const TDesC8& aFnName, const TDesC8& aLayer, TRefByValue<const TDesC16> aFmt, ...) |
59 /** |
65 /** |
60 Write the function name entry plus 16 bits formated list |
66 Write the function name entry plus 16 bits formated list |
67 TBuf<KLineLength> line; |
73 TBuf<KLineLength> line; |
68 line.Copy(iFnName); |
74 line.Copy(iFnName); |
69 line.Insert(0,_L(">>")); |
75 line.Insert(0,_L(">>")); |
70 line.Append(' '); |
76 line.Append(' '); |
71 line.Append(aFmt); |
77 line.Append(aFmt); |
72 RFileLogger::WriteFormat(KTsySubSystem, iLayer, line, list); |
78 TBuf<KLineLength> evaluatedLine; |
|
79 evaluatedLine.FormatList(line,list); |
|
80 OstTraceDefExt1(OST_TRACE_CATEGORY_DEBUG, TRACE_BORDER, TLOGENTRYEXIT_TLOGENTRYEXIT2_1, "%S", evaluatedLine); |
73 }; |
81 }; |
74 |
82 |
75 EXPORT_C TLogEntryExit::~TLogEntryExit() |
83 EXPORT_C TLogEntryExit::~TLogEntryExit() |
76 /** |
84 /** |
77 Write the function name exit |
85 Write the function name exit |
78 */ |
86 */ |
79 { |
87 { |
80 if (iErr == KErrNone) |
88 if (iErr == KErrNone) |
81 { |
89 { |
82 RFileLogger::WriteFormat(KTsySubSystem, iLayer, _L8("<<%S"), &iFnName); |
90 OstTraceDefExt1(OST_TRACE_CATEGORY_DEBUG, TRACE_BORDER, TLOGENTRYEXIT_TLOGENTRYEXIT_DTOR_1, "%s",iFnName); |
83 } |
91 } |
84 else |
92 else |
85 { |
93 { |
86 RFileLogger::WriteFormat(KTsySubSystem, iLayer, _L8("<<%S [err=%d]"), &iFnName, iErr); |
94 OstTraceDefExt2(OST_TRACE_CATEGORY_DEBUG, TRACE_BORDER, TLOGENTRYEXIT_TLOGENTRYEXIT_DTOR_2, "%s [err=%d]",iFnName, iErr); |
87 } |
95 } |
88 }; |
96 }; |
89 |
97 |
90 #else // #ifdef _DEBUG |
98 #else // #ifdef _DEBUG |
91 |
99 |
93 EXPORT_C TLogEntryExit::TLogEntryExit(const TDesC8& /*aFnName*/, const TDesC8& /*aLayer*/){}; |
101 EXPORT_C TLogEntryExit::TLogEntryExit(const TDesC8& /*aFnName*/, const TDesC8& /*aLayer*/){}; |
94 EXPORT_C TLogEntryExit::TLogEntryExit(const TDesC8& /*aFnName*/, const TDesC8& /*aLayer*/, TRefByValue<const TDesC8> /*aFmt*/, ...){}; |
102 EXPORT_C TLogEntryExit::TLogEntryExit(const TDesC8& /*aFnName*/, const TDesC8& /*aLayer*/, TRefByValue<const TDesC8> /*aFmt*/, ...){}; |
95 EXPORT_C TLogEntryExit::TLogEntryExit(const TDesC8& /*aFnName*/, const TDesC8& /*aLayer*/, TRefByValue<const TDesC16> /*aFmt*/, ...){}; |
103 EXPORT_C TLogEntryExit::TLogEntryExit(const TDesC8& /*aFnName*/, const TDesC8& /*aLayer*/, TRefByValue<const TDesC16> /*aFmt*/, ...){}; |
96 EXPORT_C TLogEntryExit::~TLogEntryExit() {}; |
104 EXPORT_C TLogEntryExit::~TLogEntryExit() {}; |
97 |
105 |
98 #endif // #ifdef _DEBUG |
106 #endif // #ifdef OST_TRACE_COMPILER_IN_USE |