ionic-team / ionic-cli

The Ionic command-line interface
MIT License
2k stars 652 forks source link

feat: consolelogs flag for cap run like Cordova #4733

Open dtarnawsky opened 3 years ago

dtarnawsky commented 3 years ago

Feature Request

Add a --consolelogs option for "cap run" to output console statements to the terminal.

Description

Cordova has an option --consolelogs which outputs console statements to the terminal. Capacitor doesn't have this feature which means "cap run" is more difficult to quickly debug.

Platform(s)

Capacitor CLI

Alternatives

The alternative is to either open the XCode IDE and view logs there (defeating the purpose of "cap run") or open Safari and view the console via attaching to the device.

jcesarmobile commented 3 years ago

Moving the issue to ionic-cli repository.

This is something ionic-cli should handle, not Capacitor, the --consolelogs is not a Cordova feature but an Ionic CLI feature.

Also, I've been looking into the --consolelogs option and it only works for angular, not just because react and vue don't officially support Cordova, but because it's part of @ionic/angular-toolkit. Also, it only works when using --livereload, which is another Ionic CLI feature, not a Capacitor feature.

Since at the moment it's a @ionic/angular-toolkit feature, it will probably need changes in whatever we use for running react and vue apps if we want --consolelogs to run there too and not just in angular.

mikelhamer commented 3 years ago

I actually just opened #4740 because I observed --consolelogs wasn't working for me in my Angular Ionic 5 / Capacitor 3 app. I guess I didn't realize this was a Cordova only feature? A little confused.

jcesarmobile commented 3 years ago

Yeah, it's a cordova and angular feature only at the moment, we have removed them from the help command and run docs for now, might try to add it in the future

mikelhamer commented 3 years ago

Shucks, and here I got excited. Hopefully this will be added to Capacitor in the future :) Thanks for the explanation!