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
108
#define NS_LOG_APPEND_CONTEXT
109
#endif
/* NS_LOG_APPEND_CONTEXT */
110
111
131
#define NS_LOG(level, msg) \
132
do \
133
{ \
134
if (g_log.IsEnabled (level)) \
135
{ \
136
NS_LOG_APPEND_TIME_PREFIX; \
137
NS_LOG_APPEND_NODE_PREFIX; \
138
NS_LOG_APPEND_CONTEXT; \
139
NS_LOG_APPEND_FUNC_PREFIX; \
140
NS_LOG_APPEND_LEVEL_PREFIX (level); \
141
std::clog << msg << std::endl; \
142
} \
143
} \
144
while (false)
145
154
#define NS_LOG_FUNCTION_NOARGS() \
155
do \
156
{ \
157
if (g_log.IsEnabled (ns3::LOG_FUNCTION)) \
158
{ \
159
NS_LOG_APPEND_TIME_PREFIX; \
160
NS_LOG_APPEND_NODE_PREFIX; \
161
NS_LOG_APPEND_CONTEXT; \
162
std::clog << g_log.Name () << ":" \
163
<< __FUNCTION__ << "()" << std::endl; \
164
} \
165
} \
166
while (false)
167
168
190
#define NS_LOG_FUNCTION(parameters) \
191
do \
192
{ \
193
if (g_log.IsEnabled (ns3::LOG_FUNCTION)) \
194
{ \
195
NS_LOG_APPEND_TIME_PREFIX; \
196
NS_LOG_APPEND_NODE_PREFIX; \
197
NS_LOG_APPEND_CONTEXT; \
198
std::clog << g_log.Name () << ":" \
199
<< __FUNCTION__ << "("; \
200
ns3::ParameterLogger (std::clog) << parameters; \
201
std::clog << ")" << std::endl; \
202
} \
203
} \
204
while (false)
205
206
214
#define NS_LOG_UNCOND(msg) \
215
do \
216
{ \
217
std::clog << msg << std::endl; \
218
} \
219
while (false)
220
221
222
#endif
/* NS3_LOG_ENABLE */
223
224
#endif
/* NS3_LOG_MACROS_ENABLED_H */
src
core
model
log-macros-enabled.h
Generated on Tue Jun 17 2014 01:12:48 for ns-3 by
1.8.6