[Ns-developers] log time -> log context

Mathieu Lacage mathieu.lacage at sophia.inria.fr
Mon May 26 20:59:44 PDT 2008


On Fri, 2008-05-23 at 09:48 -0700, Tom Henderson wrote:

> NS_LOG_COMPONENT_DEFINE ("Ipv4L3Protocol");
> #define APPEND_CONTEXT                                          \
>    if (m_node)                                                   \
>      {                                                           \
>        std::clog << m_node->GetId () << " ";                     \
>      }                                                           \
> 
> then in log.h
> 
> #define NS_LOG_FUNCTION_NOARGS()                                \
>    do                                                            \
>      {                                                           \
>        if (g_log.IsEnabled (ns3::LOG_FUNCTION))                  \
>          {                                                       \
>            APPEND_TIME_PREFIX;                                   \
>            APPEND_CONTEXT;                                       \
>            std::clog << g_log.Name () << ":"                     \
>                      << __FUNCTION__ << "()" << std::endl;       \
>          }                                                       \
>      }                                                           \
>    while (false)

I have added NS_LOG_APPEND_CONTEXT to ns-3-dev.

Mathieu



More information about the Ns-developers mailing list