talker icon indicating copy to clipboard operation
talker copied to clipboard

Fix TalkerScreen empty logs and incorrect colors for custom logs

Open Copilot opened this issue 2 months ago • 0 comments

Thanks a lot for contributing!

TalkerScreen displayed empty entries and grey colors for custom logs that override generateTextMessage() and pen properties. Console output worked correctly, but the Flutter UI ignored custom implementations.

Changes

Core Fixes:

  • data_card.dart: Enhanced _message getter to detect custom generateTextMessage() overrides via heuristics (newlines or significant length deltas)
  • talker_data.dart: Added pen color conversion as fallback in getFlutterColor() lookup chain: key → logLevel → pen → grey

New Utility:

  • ansi_color_converter.dart: Converts AnsiPen terminal colors to Flutter Colors
    • Parses ANSI escape codes (standard, bright, xterm-256, RGB)
    • Includes caching for performance
    • Color mappings extracted to static const maps

Example:

class CustomLog extends TalkerLog {
  @override
  String generateTextMessage({TimeFormat timeFormat = TimeFormat.timeAndSeconds}) {
    return '[$title] $message\nExtra: $data';  // Now displays in UI
  }

  @override
  AnsiPen get pen => AnsiPen()..magenta();  // Auto-converts to Flutter Color
}

Previously required duplicate color configuration in TalkerSettings.colors and TalkerScreenTheme.logColors. Now pen colors are automatically converted when key not found in theme.

Documentation:

  • Added docs/TALKER_SCREEN_FIXES.md with migration guide
  • Updated CHANGELOG.md
  • Added example custom logs in example/lib/custom_logs_example.dart

All changes backward compatible.

[!WARNING]

Firewall rules blocked me from connecting to one or more addresses (expand for details)

I tried to connect to the following addresses, but was blocked by firewall rules:

  • https://storage.googleapis.com/flutter_infra_release/flutter/a5cb96369ef86c7e85abf5d662a1ca5d89775053/dart-sdk-linux-x64.zip
    • Triggering command: /usr/bin/curl curl --retry 3 --continue-at - --location --output /tmp/flutter/bin/cache/dart-sdk-linux-x64.zip REDACTED packages/talker_-l ndor/bin/grep grep -l xterm\|rgb est.dart grep class.*extends Tbash (http block)
    • Triggering command: /usr/bin/curl curl --retry 3 --continue-at - --location --output /home/REDACTED/flutter/bin/cache/dart-sdk-linux-x64.zip REDACTED d_guarded_native-f grep grep -l xterm\|rgb .dart /usr/bin/grep rs s/bloc/bloc.dart--nonblock rgo/bin/grep grep (http block)

If you need me to access, download, or install something from one of these locations, you can either:

Original prompt

This section details on the original issue you should resolve

<issue_title>Incorrect colors and empty logs in TalkerScreen</issue_title> <issue_description>When using a custom log implementation that overrides generateTextMessage, pen, and key, the TalkerScreen displays incorrect colors and shows empty log entries.

Steps to Reproduce

  1. Create a custom log and override generateTextMessage.
  2. Create a custom log and override pen and key.
  3. Open TalkerScreen.
  4. Observe incorrect colors and empty logs.

Expected Behavior The colors on TalkerScreen should be displayed correctly.

Screenshots Image Image

issue.zip</issue_description>

Comments on the Issue (you are @copilot in this section)

  • Fixes Frezyx/talker#349

💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.

Copilot avatar Dec 08 '25 10:12 Copilot