|
1 // Copyright (c) 2007-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 // mesh machine logging |
|
15 // |
|
16 // |
|
17 |
|
18 /** |
|
19 @file |
|
20 @internalTechnology |
|
21 */ |
|
22 |
|
23 |
|
24 #ifndef SYMBIAN_MM_LOG_H |
|
25 #define SYMBIAN_MM_LOG_H |
|
26 |
|
27 #include <elements/nm_log.h> |
|
28 |
|
29 namespace MeshMachine |
|
30 { |
|
31 class TNodeContextBase; |
|
32 class CNodeActivityBase; |
|
33 |
|
34 class Logging |
|
35 { |
|
36 public: |
|
37 // These are used in the btrace/utrace log output as the SubCategory/Schema |
|
38 enum TLogEntryType |
|
39 { |
|
40 ELogBinary = KBinary, // Binary dump = 0 |
|
41 ELogInfo = KText, // Text output = 1 |
|
42 |
|
43 ELogContext, // = 2 |
|
44 ELogActivity, // = 3 |
|
45 }; |
|
46 |
|
47 private: |
|
48 enum |
|
49 { |
|
50 KPrimaryFilter = 195 |
|
51 }; |
|
52 |
|
53 public: |
|
54 IMPORT_C static void Printf(const TDesC8& aSubTag, TRefByValue<const TDesC8> aFmt, ...); |
|
55 IMPORT_C static void Printf(const TDesC8& aSubTag, TRefByValue<const TDesC8> aFmt, VA_LIST& aList); |
|
56 |
|
57 IMPORT_C static void LogContext(const TDesC8& aSubTag, const TNodeContextBase& aContext); |
|
58 IMPORT_C static void LogContext(const TDesC8& aSubTag, const TNodeContextBase& aContext, const TDesC8& aText); |
|
59 IMPORT_C static void LogActivity(const TDesC8& aSubTag, const CNodeActivityBase* aActivity, const TNodeContextBase* aContext); |
|
60 IMPORT_C static void LogActivity(const TDesC8& aSubTag, const CNodeActivityBase* aActivity, const TNodeContextBase* aContext, const TDesC8& aText); |
|
61 }; |
|
62 |
|
63 |
|
64 } // namespace MeshMachine |
|
65 |
|
66 |
|
67 #ifdef SYMBIAN_TRACE_ENABLE |
|
68 |
|
69 _LIT8(KMeshMachineSubTag, "meshmachine"); |
|
70 |
|
71 // Node Messages general logging |
|
72 #define MESH_LOG(logArgs) MeshMachine::Logging::Printf logArgs ; |
|
73 |
|
74 |
|
75 #define MESH_LOG_ACTIVITY(subTag, activity, context) \ |
|
76 MeshMachine::Logging::LogActivity(subTag, activity, context) |
|
77 |
|
78 #define MESH_LOG_ACTIVITY_EXT(subTag, activity, context, logTxt) \ |
|
79 { \ |
|
80 Messages::TLogTextBuf _logTxtBuf; \ |
|
81 _logTxtBuf.AppendFormatIgnoreOverflow logTxt ; \ |
|
82 MeshMachine::Logging::LogActivity(subTag, activity, context, _logTxtBuf); \ |
|
83 } |
|
84 |
|
85 |
|
86 // context = TNodeContextBase |
|
87 #define MESH_LOG_CONTEXT(subTag, context) \ |
|
88 MeshMachine::Logging::LogContext(subTag, context, _logTxtBuf) |
|
89 |
|
90 #define MESH_LOG_CONTEXT_EXT(subTag, context, logTxt) \ |
|
91 { \ |
|
92 Messages::TLogTextBuf _logTxtBuf; \ |
|
93 _logTxtBuf.AppendFormatIgnoreOverflow logTxt ; \ |
|
94 MeshMachine::Logging::LogContext(subTag, context, _logTxtBuf); \ |
|
95 } |
|
96 |
|
97 |
|
98 |
|
99 #else |
|
100 // !SYMBIAN_TRACE_ENABLE |
|
101 |
|
102 #define MESH_LOG(logArgs) |
|
103 |
|
104 #define MESH_LOG_ACTIVITY(subTag, activity, context) |
|
105 #define MESH_LOG_ACTIVITY_EXT(subTag, activity, context, logTxt) |
|
106 #define MESH_LOG_CONTEXT(subTag, context) |
|
107 #define MESH_LOG_CONTEXT_EXT(subTag, context, logTxt) |
|
108 |
|
109 #endif |
|
110 // SYMBIAN_TRACE_ENABLE |
|
111 |
|
112 |
|
113 #endif |
|
114 // SYMBIAN_MM_LOG_H |
|
115 |