Commit 188b9f86 authored by Marius Vlad's avatar Marius Vlad

compositor: Bring back the old timestamp format for the log scope

Signed-off-by: Marius Vlad's avatarMarius Vlad <marius.vlad@collabora.com>
Reported-by: Pekka Paalanen's avatarPekka Paalanen <pekka.paalanen@collabora.com>
parent 1a3c6df5
Pipeline #53822 passed with stages
in 1 minute and 9 seconds
......@@ -153,6 +153,25 @@ static int weston_log_timestamp(void)
return fprintf(weston_logfile, "[%s.%03li] ", string, tv.tv_usec/1000);
}
static char *
weston_log_generate_timestamp(char *buf, size_t len)
{
struct timeval tv;
struct tm *bdt;
char string[128];
size_t ret = 0;
gettimeofday(&tv, NULL);
bdt = localtime(&tv.tv_sec);
if (bdt)
ret = strftime(string, sizeof(string), "%H:%M:%S", bdt);
if (ret > 0)
snprintf(buf, len, "[%s.%03ld]", string, (tv.tv_usec / 1000));
return buf;
}
static void
custom_handler(const char *fmt, va_list arg)
{
......@@ -166,8 +185,8 @@ custom_handler(const char *fmt, va_list arg)
va_end(arg2);
weston_log_scope_printf(log_scope, "%s libwayland: ",
weston_log_scope_timestamp(log_scope,
timestr, sizeof timestr));
weston_log_generate_timestamp(timestr,
sizeof(timestr)));
weston_log_scope_vprintf(log_scope, fmt, arg);
}
......@@ -203,8 +222,8 @@ vlog(const char *fmt, va_list ap)
if (weston_log_scope_is_enabled(log_scope)) {
weston_log_scope_printf(log_scope, "%s ",
weston_log_scope_timestamp(log_scope,
timestr, sizeof timestr));
weston_log_generate_timestamp(timestr,
sizeof(timestr)));
weston_log_scope_vprintf(log_scope, fmt, ap);
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment