[quagga-dev 4211] Re: debug messages on terminal session do not include timestamps

Andrew J. Schorr aschorr at telemetry-investments.com
Mon Jul 3 14:54:41 IST 2006


Is it safe to assume from the silence that it's OK to commit this patch?

Regards,
Andy

On Thu, Jun 29, 2006 at 12:28:42PM -0400, Andrew J. Schorr wrote:
> I'm doing some debugging on a terminal session and trying to understand the
> timing of various events, and I'm frustrated by the fact that the vty debug
> messages do not include timestamps (whereas the messages logged to files
> always include timestamps).  Is there any reason that lib/vty.c:vty_log_out
> shouldn't be patched to include a timestamp?  Perhaps something
> like the attached?
> 
> Regards,
> Andy

> Index: lib/vty.c
> ===================================================================
> RCS file: /var/cvsroot/quagga/lib/vty.c,v
> retrieving revision 1.52
> diff -b -u -p -r1.52 vty.c
> --- lib/vty.c	28 May 2006 08:18:38 -0000	1.52
> +++ lib/vty.c	29 Jun 2006 16:27:14 -0000
> @@ -154,12 +154,18 @@ vty_log_out (struct vty *vty, const char
>    int ret;
>    int len;
>    char buf[1024];
> +  struct tm *tm;
> +
> +  if ((tm = localtime(&recent_time.tv_sec)) != NULL)
> +    len = strftime(buf, sizeof(buf), "%Y/%m/%d %H:%M:%S ", tm);
> +  else
> +    len = 0;
>  
>    if (level)
> -    len = snprintf(buf, sizeof(buf), "%s: %s: ", level, proto_str);
> +    ret = snprintf(buf+len, sizeof(buf)-len, "%s: %s: ", level, proto_str);
>    else
> -    len = snprintf(buf, sizeof(buf), "%s: ", proto_str);
> -  if ((len < 0) || ((size_t)len >= sizeof(buf)))
> +    ret = snprintf(buf+len, sizeof(buf)-len, "%s: ", proto_str);
> +  if ((ret < 0) || ((size_t)(len += ret) >= sizeof(buf)))
>      return -1;
>  
>    if (((ret = vsnprintf(buf+len, sizeof(buf)-len, format, va)) < 0) ||

> _______________________________________________
> Quagga-dev mailing list
> Quagga-dev at lists.quagga.net
> http://lists.quagga.net/mailman/listinfo/quagga-dev


More information about the Quagga-dev mailing list