compositor: Pass the entire string in one-shot when writting logger data
This fixes the situation where the same logger scope is passed multiple times and the timestamp is being sent before the log mesasge. Signed-off-by: Marius Vlad <marius.vlad@collabora.com> Reported-by: Pekka Paalanen <pekka.paalanen@collabora.com>
This commit is contained in:
parent
3a2f829983
commit
ded0b77316
@ -199,14 +199,24 @@ weston_log_file_close(void)
|
||||
static int
|
||||
vlog(const char *fmt, va_list ap)
|
||||
{
|
||||
const char *oom = "Out of memory";
|
||||
char timestr[128];
|
||||
int len = 0;
|
||||
char *str;
|
||||
|
||||
if (weston_log_scope_is_enabled(log_scope)) {
|
||||
len = weston_log_scope_printf(log_scope, "%s ",
|
||||
weston_log_timestamp(timestr,
|
||||
sizeof timestr));
|
||||
len += weston_log_scope_vprintf(log_scope, fmt, ap);
|
||||
int len_va;
|
||||
char *log_timestamp = weston_log_timestamp(timestr,
|
||||
sizeof(timestr));
|
||||
len_va = vasprintf(&str, fmt, ap);
|
||||
if (len_va >= 0) {
|
||||
len = weston_log_scope_printf(log_scope, "%s %s",
|
||||
log_timestamp, str);
|
||||
free(str);
|
||||
} else {
|
||||
len = weston_log_scope_printf(log_scope, "%s %s",
|
||||
log_timestamp, oom);
|
||||
}
|
||||
}
|
||||
|
||||
return len;
|
||||
|
Loading…
Reference in New Issue
Block a user