A Discrete-Event Network Simulator
Home
Tutorials ▼
English
Portuguese
Docs ▼
Wiki
Manual
Models
Develop ▼
API
Bugs
API
Main Page
Related Pages
Modules
Namespaces
Classes
Files
File List
File Members
All
Classes
Namespaces
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Properties
Friends
Macros
Groups
Pages
log-macros-enabled.h
Go to the documentation of this file.
1
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
2
/*
3
* Copyright (c) 2006,2007 INRIA
4
*
5
* This program is free software; you can redistribute it and/or modify
6
* it under the terms of the GNU General Public License version 2 as
7
* published by the Free Software Foundation;
8
*
9
* This program is distributed in the hope that it will be useful,
10
* but WITHOUT ANY WARRANTY; without even the implied warranty of
11
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12
* GNU General Public License for more details.
13
*
14
* You should have received a copy of the GNU General Public License
15
* along with this program; if not, write to the Free Software
16
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17
*
18
* Author: Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
19
*/
20
21
#ifndef NS3_LOG_MACROS_ENABLED_H
22
#define NS3_LOG_MACROS_ENABLED_H
23
24
#ifdef NS3_LOG_ENABLE
25
26
33
#define NS_LOG_APPEND_TIME_PREFIX \
34
if (g_log.IsEnabled (ns3::LOG_PREFIX_TIME)) \
35
{ \
36
ns3::LogTimePrinter printer = ns3::LogGetTimePrinter (); \
37
if (printer != 0) \
38
{ \
39
(*printer)(std::clog); \
40
std::clog << " "; \
41
} \
42
}
43
50
#define NS_LOG_APPEND_NODE_PREFIX \
51
if (g_log.IsEnabled (ns3::LOG_PREFIX_NODE)) \
52
{ \
53
ns3::LogNodePrinter printer = ns3::LogGetNodePrinter (); \
54
if (printer != 0) \
55
{ \
56
(*printer)(std::clog); \
57
std::clog << " "; \
58
} \
59
}
60
67
#define NS_LOG_APPEND_FUNC_PREFIX \
68
if (g_log.IsEnabled (ns3::LOG_PREFIX_FUNC)) \
69
{ \
70
std::clog << g_log.Name () << ":" << \
71
__FUNCTION__ << "(): "; \
72
} \
73
74
80
#define NS_LOG_APPEND_LEVEL_PREFIX(level) \
81
if (g_log.IsEnabled (ns3::LOG_PREFIX_LEVEL)) \
82
{ \
83
std::clog << "[" << g_log.GetLevelLabel (level) << "] "; \
84
} \
85
86
87
#ifndef NS_LOG_APPEND_CONTEXT
88
105
#define NS_LOG_APPEND_CONTEXT
106
#endif
/* NS_LOG_APPEND_CONTEXT */
107
108
109
#ifndef NS_LOG_CONDITION
110
124
#define NS_LOG_CONDITION
125
#endif
126
146
#define NS_LOG(level, msg) \
147
NS_LOG_CONDITION \
148
do \
149
{ \
150
if (g_log.IsEnabled (level)) \
151
{ \
152
NS_LOG_APPEND_TIME_PREFIX; \
153
NS_LOG_APPEND_NODE_PREFIX; \
154
NS_LOG_APPEND_CONTEXT; \
155
NS_LOG_APPEND_FUNC_PREFIX; \
156
NS_LOG_APPEND_LEVEL_PREFIX (level); \
157
std::clog << msg << std::endl; \
158
} \
159
} \
160
while (false)
161
170
#define NS_LOG_FUNCTION_NOARGS() \
171
NS_LOG_CONDITION \
172
do \
173
{ \
174
if (g_log.IsEnabled (ns3::LOG_FUNCTION)) \
175
{ \
176
NS_LOG_APPEND_TIME_PREFIX; \
177
NS_LOG_APPEND_NODE_PREFIX; \
178
NS_LOG_APPEND_CONTEXT; \
179
std::clog << g_log.Name () << ":" \
180
<< __FUNCTION__ << "()" << std::endl; \
181
} \
182
} \
183
while (false)
184
185
207
#define NS_LOG_FUNCTION(parameters) \
208
NS_LOG_CONDITION \
209
do \
210
{ \
211
if (g_log.IsEnabled (ns3::LOG_FUNCTION)) \
212
{ \
213
NS_LOG_APPEND_TIME_PREFIX; \
214
NS_LOG_APPEND_NODE_PREFIX; \
215
NS_LOG_APPEND_CONTEXT; \
216
std::clog << g_log.Name () << ":" \
217
<< __FUNCTION__ << "("; \
218
ns3::ParameterLogger (std::clog) << parameters; \
219
std::clog << ")" << std::endl; \
220
} \
221
} \
222
while (false)
223
224
232
#define NS_LOG_UNCOND(msg) \
233
NS_LOG_CONDITION \
234
do \
235
{ \
236
std::clog << msg << std::endl; \
237
} \
238
while (false)
239
240
241
#endif
/* NS3_LOG_ENABLE */
242
243
#endif
/* NS3_LOG_MACROS_ENABLED_H */
src
core
model
log-macros-enabled.h
Generated on Fri Dec 5 2014 17:29:05 for ns-3 by
1.8.6