add NS_LOG_APPEND_CONTEXT
authorMathieu Lacage <mathieu.lacage@sophia.inria.fr>
Mon, 26 May 2008 21:00:25 -0700
changeset 3095ea368d066bea
parent 3094 6e787ec9c8aa
child 3096 dc8b5959ab61
add NS_LOG_APPEND_CONTEXT
src/core/log.h
     1.1 --- a/src/core/log.h	Mon May 26 20:48:54 2008 -0700
     1.2 +++ b/src/core/log.h	Mon May 26 21:00:25 2008 -0700
     1.3 @@ -69,7 +69,7 @@
     1.4  #define NS_LOG_COMPONENT_DEFINE(name)                           \
     1.5    static ns3::LogComponent g_log = ns3::LogComponent (name)
     1.6  
     1.7 -#define APPEND_TIME_PREFIX                                      \
     1.8 +#define NS_LOG_APPEND_TIME_PREFIX                               \
     1.9    if (g_log.IsEnabled (ns3::LOG_PREFIX_TIME))                   \
    1.10      {                                                           \
    1.11        LogTimePrinter printer = LogGetTimePrinter ();            \
    1.12 @@ -80,13 +80,17 @@
    1.13          }                                                       \
    1.14      }
    1.15  
    1.16 -#define APPEND_FUNC_PREFIX                                      \
    1.17 +#define NS_LOG_APPEND_FUNC_PREFIX                               \
    1.18    if (g_log.IsEnabled (ns3::LOG_PREFIX_FUNC))                   \
    1.19      {                                                           \
    1.20        std::clog << g_log.Name () << ":" <<                      \
    1.21          __FUNCTION__ << "(): ";                                 \
    1.22      }                                                           \
    1.23  
    1.24 +#ifndef NS_LOG_APPEND_CONTEXT
    1.25 +#define NS_LOG_APPEND_CONTEXT
    1.26 +#endif /* NS_LOG_APPEND_CONTEXT */
    1.27 +
    1.28  
    1.29  /**
    1.30   * \ingroup logging
    1.31 @@ -107,8 +111,9 @@
    1.32      {                                                           \
    1.33        if (g_log.IsEnabled (level))                              \
    1.34          {                                                       \
    1.35 -          APPEND_TIME_PREFIX;                                   \
    1.36 -          APPEND_FUNC_PREFIX;                                   \
    1.37 +          NS_LOG_APPEND_TIME_PREFIX;                            \
    1.38 +          NS_LOG_APPEND_CONTEXT;                                \
    1.39 +          NS_LOG_APPEND_FUNC_PREFIX;                            \
    1.40            std::clog << msg << std::endl;                        \
    1.41          }                                                       \
    1.42      }                                                           \
    1.43 @@ -160,7 +165,8 @@
    1.44      {                                                           \
    1.45        if (g_log.IsEnabled (ns3::LOG_FUNCTION))                  \
    1.46          {                                                       \
    1.47 -          APPEND_TIME_PREFIX;                                   \
    1.48 +          NS_LOG_APPEND_TIME_PREFIX;                            \
    1.49 +          NS_LOG_APPEND_CONTEXT;                                \
    1.50            std::clog << g_log.Name () << ":"                     \
    1.51                      << __FUNCTION__ << "()" << std::endl;       \
    1.52          }                                                       \
    1.53 @@ -189,7 +195,8 @@
    1.54      {                                                   \
    1.55        if (g_log.IsEnabled (ns3::LOG_FUNCTION))          \
    1.56          {                                               \
    1.57 -          APPEND_TIME_PREFIX;                           \
    1.58 +          NS_LOG_APPEND_TIME_PREFIX;                    \
    1.59 +          NS_LOG_APPEND_CONTEXT;                        \
    1.60            std::clog << g_log.Name () << ":"             \
    1.61                      << __FUNCTION__ << "(";             \
    1.62            ParameterLogger (std::clog)  << parameters;   \