talker icon indicating copy to clipboard operation
talker copied to clipboard

Max length for log messages

Open amrgetment opened this issue 4 months ago • 2 comments

Is your feature request related to a problem? Please describe. I have a bloc state and event that prints thousands of objects which slows down my app and it prints a very long log

Describe the solution you'd like I want a way to set the max length for each log message

Additional context I parse a CSV file with 1000 rows which makes this issue, with max length I will have cleaner logs

amrgetment avatar Feb 09 '24 15:02 amrgetment

Hello @amrgetment ! Great idea, I will think how we can implement that functionality in future versions

Frezyx avatar Feb 15 '24 08:02 Frezyx

@Frezyx Thanks a lot

here for bloc messages you use settings.printStateFullData, so same you could use settings.maxLength

  String _createMessage() {
    final sb = StringBuffer();
    sb.write(displayTitleWithTime);
    sb.write('\n$message');
    sb.write(
        '\n${'CURRENT state: ${settings.printStateFullData ? '\n${transition.currentState}' : transition.currentState.runtimeType}'}');
    sb.write(
        '\n${'NEXT state: ${settings.printStateFullData ? '\n${transition.nextState}' : transition.nextState.runtimeType}'}');
    return sb.toString();
  }
}

amrgetment avatar Feb 15 '24 08:02 amrgetment