Skip to content

Commit

Permalink
Merge pull request #816 from atsign-foundation/fix_bug_in_truncateFor…
Browse files Browse the repository at this point in the history
…Logging_function

fix: Fixed truncateForLogging function so it doesn't ignore characters after a newline.
  • Loading branch information
gkc authored Jul 20, 2022
2 parents 7add688 + 1893f44 commit df9d15b
Showing 1 changed file with 1 addition and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -56,14 +56,10 @@ abstract class BaseConnection extends AtConnection {
}
}

static String truncateForLogging(String toLog, {int cutOffAfter = 1000}) {
static String truncateForLogging(String toLog, {int cutOffAfter = 2100}) {
if (toLog.length > cutOffAfter) {
toLog = '${toLog.substring(0, cutOffAfter)} [truncated, ${toLog.length - cutOffAfter} more chars]';
}
var lastNewLinePos = toLog.lastIndexOf("\n");
if (lastNewLinePos > -1) {
toLog = toLog.substring(0, lastNewLinePos);
}
return toLog;
}
}

0 comments on commit df9d15b

Please sign in to comment.