talker icon indicating copy to clipboard operation
talker copied to clipboard

Using `dart:developer`'s `log` instead of `print` unexpectedly shuffles the log lines

Open lucavenir opened this issue 1 year ago • 1 comments

Describe the bug Take this configuration:

import 'dart:developer' as developer;
import 'package:talker_flutter/talker_flutter.dart';

final talker = Talker(
  logger: TalkerLogger(
    output: (String message) => message.split('\n').forEach(developer.log),
  ),
);

It will output logs like so:

[log] │ [route] | 19:50:08 974ms | Open route named /splash
[log] │ Arguments: {}
[log] ┌────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
[log] └────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────

Or:

[log] │ [http-response] [GET] https://api.weatherapi.com/v1/current.json?key=mykey&q=location
[log] │ Status: 200
[log] │ Message: OK
[log] │ Data: {
[log] │   "location": { ... },
[log] │   "current": { ... }
[log] │ }
[log] ┌────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
[log] └────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────

Expected behavior The logs, sorted as they they come

Details: Compiling from Linux, target Android

Additional context I'm trying out log because I want to get rid of the I/flutter annoying prefixes, somehow. If you show me how to get rid of that without using log, I'll gladly close this issue.

Workarounds None. I'm using debugPrintSynchronously from flutter/foundation as of now.

lucavenir avatar Feb 03 '24 18:02 lucavenir