SourceHorizon / logger

Small, easy to use and extensible logger which prints beautiful logs.
https://pub.dev/packages/logger
MIT License
197 stars 33 forks source link

truncated log message in iOS #45

Closed harlanerskine closed 11 months ago

harlanerskine commented 11 months ago

When outputting iOS logs, I see the message <...> at the end of my logs but not in the same log on the Android emulator.

iOS:

Reloaded 1 of 710 libraries in 177ms (compile: 18 ms, reload: 66 ms, reassemble: 75 ms). flutter: \^[[38;5;12m┌───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────<…> flutter: \^[[38;5;12m│ 💡 test Screen<…> flutter: \^[[38;5;12m└───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────<…>

Android:

Restarted application in 1,068ms. I/flutter ( 9044): ┌─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────── I/flutter ( 9044): │ test Screen I/flutter ( 9044): └───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────

harlanerskine commented 11 months ago

Here is the simple code I am using:

import 'package:flutter/material.dart';
import 'package:logger/logger.dart';

void main() => runApp(MyApp());

class MyApp extends StatelessWidget {
  final loggerNoStack = Logger(
    printer: PrettyPrinter(
      methodCount: 0,
      colors: false,
      printEmojis: false,
    ),
  );

  MyApp({super.key});

  @override
  Widget build(BuildContext context) {
    loggerNoStack.i('test Screen');

    return MaterialApp(
      title: 'Logger Test',
      theme: ThemeData(
        primarySwatch: Colors.blue,
      ),
      home: Scaffold(
        appBar: AppBar(title: const Text('Logger Test')),
        body: const Center(child: Text('Check your logs!')),
      ),
    );
  }
}

Changing colors and printEmojis to true resulted in the same error.

Bungeefan commented 11 months ago

This is a known limitation of the iOS platform with Flutter: https://github.com/flutter/flutter/issues/22665

Unfortunately, this is nothing we can fix or workaround on our side. As this is a pure dart package (no dependency on flutter) we cannot provide any workaround class that uses Flutter-specific functions. However, you can easily create your own Output class with the workaround mentioned in the Flutter issue above.