[Ns-developers] log time -> log context

Mathieu Lacage mathieu.lacage at sophia.inria.fr
Fri May 23 18:00:27 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)

For anything but the node id, yes, this is what I would tend to favor.
For the node id, I am partly skewed but I would be happy to support an
API which involves Simulator::Schedule because I can see a couple of
other interesting uses for that API, none of which are needed now, but
which would be cool to have eventually.

regards,
Mathieu



More information about the Ns-developers mailing list