Skip to content

Commit

Permalink
Show ellipsis sign when log line is truncated
Browse files Browse the repository at this point in the history
  • Loading branch information
arkaitzj committed Jun 3, 2012
1 parent 9b81dbf commit 9a2b240
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion src/rt/rust_sched_loop.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,13 @@ rust_sched_loop::log(rust_task* task, uint32_t level, char const *fmt, ...) {
char buf[BUF_BYTES];
va_list args;
va_start(args, fmt);
vsnprintf(buf, sizeof(buf), fmt, args);
int formattedbytes = vsnprintf(buf, sizeof(buf), fmt, args);
if( formattedbytes and (unsigned)formattedbytes > BUF_BYTES ){
const char truncatedstr[] = "[...]";
memcpy( &buf[BUF_BYTES-sizeof(truncatedstr)],
truncatedstr,
sizeof(truncatedstr));
}
_log.trace_ln(task, level, buf);
va_end(args);
}
Expand Down

0 comments on commit 9a2b240

Please sign in to comment.