lumberdash icon indicating copy to clipboard operation
lumberdash copied to clipboard

Make logError easier human readable in console

Open passsy opened this issue 5 years ago • 4 comments

The current output of logError in console is hard to scan.

flutter: [ERROR] { exception: An error occured, stacktrace: #0      Auth0Authentication.refreshLogin.<anonymous closure> (package:my_app/authenticate/auth0_authentication.dart:168:11)
<asynchronous suspension>
#1      Auth0Authentication.refreshLogin.<anonymous closure> (package:my_app/authenticate/auth0_authentication.dart)
#2      Auth0Authentication.refreshLogin (package:my_app/authenticate/auth0_authentication.dart:172:6)
#3      SessionManager.autoLogin (package:my_app/src/session/session_manager.dart:39:36)
<asynchronous suspension>
  1. The log message doesn't start with the error message but with { exception:
  2. The first list of the stacktrace is in the same line as the message pushing the important part out of view (without softwrap)
  3. Not having #0 at the beginning of the line breaks the parsing of stacktraces for tools. IntelliJ isn't able to collapse long stacktraces.

The proposed changed adds a newline before the stacktrace starts and removes the curly braces. The output of this change looks like this:

flutter: [ERROR] Auth0 lib failed while parsing the auth0 error response
#0      Auth0Authentication.refreshLogin.<anonymous closure> (package:my_app/authenticate/auth0_authentication.dart:168:11)
<asynchronous suspension>
#1      Auth0Authentication.refreshLogin.<anonymous closure> (package:my_app/authenticate/auth0_authentication.dart)
#2      Auth0Authentication.refreshLogin (package:my_app/authenticate/auth0_authentication.dart:172:6)
#3      SessionManager.autoLogin (package:my_app/src/session/session_manager.dart:39:36)
<asynchronous suspension>
#4      runhApp.<anonymous closure>.<anonymous closure> (package:my_app/app/app.dart:105:30)
<asynchronous suspension> [4 more...]
  • [x] The error message is easy to read
  • [x] Stacktrace line #0 starts at new line
  • [x] IntelliJ collapsing works

passsy avatar Jul 13 '20 10:07 passsy

@jorgecoca @felangel push. Is anyone of you still maintaining this project?

passsy avatar Sep 04 '20 14:09 passsy

@tchabot22 @dakrawczyk can you folks take a look (and resolve the pipeline issue)? Thanks!

jorgecoca avatar Sep 04 '20 14:09 jorgecoca

@dakrawczyk any chance you can push this PR forward ?

tlvenn avatar Jan 06 '21 08:01 tlvenn

@passsy could you rebase on the base branch so it's ready to be merged ?

tlvenn avatar Jan 06 '21 08:01 tlvenn