diff options
| author | toddaaro <github@opprobrio.us> | 2013-08-02 16:48:29 -0700 |
|---|---|---|
| committer | Daniel Micay <danielmicay@gmail.com> | 2013-08-03 03:09:04 -0400 |
| commit | eab749a5f326b0cab3a1f71f260a35c96d263758 (patch) | |
| tree | 9b314c0aa27c17549bac6f865103606cac95c81c /src/libstd | |
| parent | deddb009f0003734d3c73fa859826d57ec600270 (diff) | |
| download | rust-eab749a5f326b0cab3a1f71f260a35c96d263758.tar.gz rust-eab749a5f326b0cab3a1f71f260a35c96d263758.zip | |
modified logging function to truncate output and adjusted error output formatting tests to be compatible with both the new and old runtimes
Diffstat (limited to 'src/libstd')
| -rw-r--r-- | src/libstd/logging.rs | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/src/libstd/logging.rs b/src/libstd/logging.rs index 6e11d14aea9..c53e7e82841 100644 --- a/src/libstd/logging.rs +++ b/src/libstd/logging.rs @@ -85,6 +85,16 @@ pub fn log_type<T>(level: u32, object: &T) { fn newsched_log_str(msg: ~str) { use rt::task::Task; use rt::local::Local; + use str::StrSlice; + use container::Container; + + // Truncate the string + let buf_bytes = 2048; + let msg = if msg.len() > buf_bytes { + msg.slice(0, buf_bytes) + "[...]" + } else { + msg + }; unsafe { match Local::try_unsafe_borrow::<Task>() { |
