split long log lines

This commit is contained in:
Peter 'Pita' Martischka 2012-11-03 18:14:54 +00:00
parent 08a2d28a99
commit ba1115376f
1 changed files with 11 additions and 1 deletions

View File

@ -72,8 +72,18 @@ $(function(){
space+=" ";
}
var splitedText = "";
_(text.split("\n")).each(function(line){
while(line.length > 0){
var split = line.substr(0,100);
line = line.substr(100);
if(splitedText.length > 0) splitedText+="\n";
splitedText += split;
}
});
//indent all lines with the given amount of space
var newText = _(text.split("\n")).map(function(line){
var newText = _(splitedText.split("\n")).map(function(line){
return space + line;
}).join("\\n");