about summary refs log tree commit diff
path: root/src/libstd
diff options
context:
space:
mode:
authortoddaaro <github@opprobrio.us>2013-08-02 16:48:29 -0700
committerDaniel Micay <danielmicay@gmail.com>2013-08-03 03:09:04 -0400
commiteab749a5f326b0cab3a1f71f260a35c96d263758 (patch)
tree9b314c0aa27c17549bac6f865103606cac95c81c /src/libstd
parentdeddb009f0003734d3c73fa859826d57ec600270 (diff)
downloadrust-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.rs10
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>() {