[libvirt] [PATCH 2/2] logging: Add date to log timestamp

Daniel Veillard veillard at redhat.com
Thu Sep 29 10:14:37 UTC 2011


On Wed, Sep 28, 2011 at 04:46:12PM +0200, Jiri Denemark wrote:
> ---
>  src/util/logging.c |    4 +++-
>  1 files changed, 3 insertions(+), 1 deletions(-)
> 
> diff --git a/src/util/logging.c b/src/util/logging.c
> index 4ffaf75..9df9003 100644
> --- a/src/util/logging.c
> +++ b/src/util/logging.c
> @@ -627,8 +627,10 @@ virLogFormatTimestamp(void)
>  
>      gettimeofday(&cur_time, NULL);
>      localtime_r(&cur_time.tv_sec, &time_info);
> +    time_info.tm_year += 1900;
>  
> -    if (virAsprintf(&str, "%02d:%02d:%02d.%03d",
> +    if (virAsprintf(&str, "%4d-%02d-%02d %02d:%02d:%02d.%03d",
> +                    time_info.tm_year, time_info.tm_mon, time_info.tm_mday,
>                      time_info.tm_hour, time_info.tm_min, time_info.tm_sec,
>                      (int) (cur_time.tv_usec / 1000)) < 0)
>          return NULL;

  So ACK to both :-)

Daniel

-- 
Daniel Veillard      | libxml Gnome XML XSLT toolkit  http://xmlsoft.org/
daniel at veillard.com  | Rpmfind RPM search engine http://rpmfind.net/
http://veillard.com/ | virtualization library  http://libvirt.org/




More information about the libvir-list mailing list