flutter-tools.nvim icon indicating copy to clipboard operation
flutter-tools.nvim copied to clipboard

[Bug]: dart:developer logs are not showing up in the dev log

Open Thesmader opened this issue 2 years ago • 5 comments

Describe the bug While running Flutter applications, logs using log() from dart:developer are not showing up in the dev log.

My configuration:

 require('flutter-tools').setup{
   dev_log = {
     enabled = true,
     open_cmd = "tabedit"
   },
   dev_tools = {
     autostart = true
   },
   --debugger = {
     --enabled = true,
     --run_via_dap = true,
     --register_configurations = function(_)
       --require("dap").configurations.dart = {}
       --require("dap.ext.vscode").load_launchjs()
    --end,
   --}
 }

The issue is there, whether or not the debugger is enabled or run_via_dap is set to true.

To Reproduce Steps to reproduce the behavior:

  1. Create a new flutter project(default counter app)
  2. Use the log() method from dart:developer to log something( maybe log the value of _counter in the _incrementCounter() method.

Expected behavior The log should show up in the dev log.

System information

  • OS: Manjaro Linux
  • Flutter version: 2.8.1
  • Is flutter in $PATH: Yes
  • neovim version: v0.7.0-dev+994-g5be2cdd91

Additional context According to #3653 on the Dart-Code repo these logs only work while debugging.

Thank you for this awesome plugin :smile:

Thesmader avatar Feb 02 '22 17:02 Thesmader

@akinsho Sorry to bug you. I understand that you might have a lot of things on your plate :sweat_smile: . May I get a little help here? I really want this to work if it's possible :grimacing:

Thesmader avatar Feb 21 '22 15:02 Thesmader

@Thesmader unfortunately I can't be of much help, I definitely don't have the bandwidth to dig into this, and it's definitely not something I personally ever encounter since I don't use dart:developer logs.

Based on the issue you linked, seems that are intended to only be shown when the app is run in debug mode, so possible only whilst using something like run_with_dap. If they don't show up in the normal stdout of the flutter run command, then I can't do anything about that. If they are part of the logs whilst being run via dap then you could have a look at the dap_runner.lua file. There are specific events being listened too and appended to the log, and the dev logs might be an event within that.

I don't know which it is or really how the dap runner works since another user contributed it (🙏🏿 ).

akinsho avatar Feb 21 '22 16:02 akinsho

@Thesmader did you figure this one out?

euler007 avatar Jul 25 '22 10:07 euler007

Hi @euler007 . I believe the dart developer logs are showing up atleast while developing on mobile. Haven't tried with web or other platforms.

Thesmader avatar Jul 28 '22 05:07 Thesmader

Yeah without dap, the dev logs won't come up

Otherwise you can see them in devtools; in dev tools -> logging, you can apply a filter, iirc -k:flutter.frame to reduce the noise and get (mostly) just your logging

RyanCarrier avatar Jun 12 '23 02:06 RyanCarrier