author | Oscar Gonzalez <oscar.1.gonzalez@nokia.com> |
Fri, 04 Jun 2010 13:03:15 +0100 | |
branch | opencode |
changeset 35 | 6fbc08ed9c42 |
parent 32 | 58332560b319 |
permissions | -rw-r--r-- |
24 | 1 |
// Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies). |
2 |
// All rights reserved. |
|
3 |
// This component and the accompanying materials are made available |
|
4 |
// under the terms of "Eclipse Public License v1.0" |
|
5 |
// which accompanies this distribution, and is available |
|
6 |
// at the URL "http://www.eclipse.org/legal/epl-v10.html". |
|
7 |
// |
|
8 |
// Initial Contributors: |
|
9 |
// Nokia Corporation - initial contribution. |
|
10 |
// |
|
11 |
// Contributors: |
|
12 |
// |
|
13 |
// Description: |
|
14 |
// CommsDebugUtil logging support for the CTSY Dispatcher. |
|
15 |
// |
|
16 |
||
17 |
||
18 |
||
19 |
||
20 |
/** |
|
21 |
@file |
|
32
58332560b319
Bring opencode branch up-to-date with latest cellularsrv changes
Oscar Gonzalez <oscar.1.gonzalez@nokia.com>
parents:
24
diff
changeset
|
22 |
@internalAll |
24 | 23 |
*/ |
24 |
||
25 |
#ifndef __LTSYLOGGER_H_ |
|
26 |
#define __LTSYLOGGER_H_ |
|
27 |
||
28 |
#include <e32base.h> |
|
29 |
||
30 |
#ifdef _DEBUG |
|
31 |
||
32 |
#include <comms-infras/commsdebugutility.h> |
|
33 |
_LIT8(KTsySubSystem, "tsy"); |
|
34 |
_LIT8(KTsyCompnt, "ctsydis"); |
|
35 |
||
36 |
/** Regular logging macro */ |
|
37 |
#define LOG(format, ARGS...) \ |
|
38 |
{ \ |
|
39 |
RFileLogger::WriteFormat(KTsySubSystem, KTsyCompnt, format, ##ARGS); \ |
|
40 |
} |
|
41 |
||
42 |
/** Macros to log function entry and exit */ |
|
43 |
//#define TSYLOGENTRYEXIT(aFunc) TLogEntryExit __logger((aFunc), KTsyCompnt) |
|
44 |
||
45 |
//#define TSYLOGENTRYEXITARGS(aFunc, aFmt, ARGS...) TLogEntryExit __logger((aFunc), KTsyCompnt, (aFmt), ##ARGS); |
|
46 |
||
47 |
#define TSYLOGENTRYEXIT /*lint -save -e40*/ TLogEntryExit __logger(TPtrC8((const TUint8*)__PRETTY_FUNCTION__), KTsyCompnt)/*lint -restore*/ |
|
48 |
||
49 |
// N.B. The function name does not need to be specified |
|
50 |
#define TSYLOGENTRYEXITARGS(aFmt, ARGS...) /*lint -save -e40*/ TLogEntryExit __logger(TPtrC8((const TUint8*)__PRETTY_FUNCTION__), KTsyCompnt, (aFmt), ##ARGS)/*lint -restore*/ |
|
51 |
||
52 |
#define TSYLOGSETEXITERR(aErr) __logger.SetExitErrorCode( aErr ) |
|
53 |
||
54 |
||
55 |
/** |
|
56 |
Automatic class that logs function entry and exit |
|
57 |
*/ |
|
58 |
class TLogEntryExit |
|
59 |
{ |
|
60 |
public: |
|
61 |
IMPORT_C TLogEntryExit(const TDesC8& aFnName, const TDesC8& aLayer); |
|
62 |
IMPORT_C TLogEntryExit(const TDesC8& aFnName, const TDesC8& aLayer, TRefByValue<const TDesC8> aFmt, ...); |
|
63 |
IMPORT_C TLogEntryExit(const TDesC8& aFnName, const TDesC8& aLayer, TRefByValue<const TDesC16> aFmt, ...); |
|
64 |
IMPORT_C ~TLogEntryExit(); |
|
65 |
inline TInt SetExitErrorCode(TInt aErr); |
|
66 |
private: |
|
67 |
TPtrC8 iFnName; |
|
68 |
TPtrC8 iLayer; |
|
69 |
TInt iErr; |
|
70 |
}; // class TLogEntryExit |
|
71 |
||
72 |
/** |
|
73 |
Set the error that will be logged at function exit |
|
74 |
||
75 |
@param aErr error code to log |
|
76 |
@return the given error code. This is to allow to pipe the function call |
|
77 |
*/ |
|
78 |
TInt TLogEntryExit::SetExitErrorCode(TInt aErr) |
|
79 |
{ |
|
80 |
return iErr = aErr; |
|
81 |
} |
|
82 |
||
83 |
||
84 |
||
85 |
#else // _DEBUG |
|
86 |
||
87 |
#define LOG(format, ARGS...) |
|
88 |
#define TSYLOGENTRYEXIT |
|
89 |
#define TSYLOGENTRYEXITARGS(aFunc, aFmt, ARGS...) |
|
90 |
#define TSYLOGSETEXITERR(aErr) aErr // So that we don't lose the return code in UREL! |
|
91 |
||
92 |
||
93 |
/** |
|
94 |
Stub class for urel builds, required for exports. |
|
95 |
*/ |
|
96 |
class TLogEntryExit |
|
97 |
{ |
|
98 |
public: |
|
99 |
IMPORT_C TLogEntryExit(const TDesC8& aFnName, const TDesC8& aLayer); |
|
100 |
IMPORT_C TLogEntryExit(const TDesC8& aFnName, const TDesC8& aLayer, TRefByValue<const TDesC8> aFmt, ...); |
|
101 |
IMPORT_C TLogEntryExit(const TDesC8& aFnName, const TDesC8& aLayer, TRefByValue<const TDesC16> aFmt, ...); |
|
102 |
IMPORT_C ~TLogEntryExit(); |
|
103 |
}; |
|
104 |
||
105 |
||
106 |
||
107 |
#endif // _DEBUG |
|
108 |
||
109 |
#endif // __LTSYLOGGER_H_ |