diff options
| author | Arkaitz Jimenez <arkaitzj@gmail.com> | 2012-06-03 20:51:17 +0100 |
|---|---|---|
| committer | Arkaitz Jimenez <arkaitzj@gmail.com> | 2012-06-03 21:06:42 +0100 |
| commit | 9a2b240c89bbc0c1f2d969fd59ce458a2b40eab5 (patch) | |
| tree | 61f9cf4ca1d92c820d50e5cef2b279d5110876bc | |
| parent | 9b81dbfef3322ea2c05fe92a2b7cc6bbecbc33fe (diff) | |
| download | rust-9a2b240c89bbc0c1f2d969fd59ce458a2b40eab5.tar.gz rust-9a2b240c89bbc0c1f2d969fd59ce458a2b40eab5.zip | |
Show ellipsis sign when log line is truncated
| -rw-r--r-- | src/rt/rust_sched_loop.cpp | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/src/rt/rust_sched_loop.cpp b/src/rt/rust_sched_loop.cpp index 697f460d3a6..27883391cce 100644 --- a/src/rt/rust_sched_loop.cpp +++ b/src/rt/rust_sched_loop.cpp @@ -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); } |
