-
Notifications
You must be signed in to change notification settings - Fork 13.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: Add option to IonicConfig to disable Ionic warning and error logs #29814
Comments
@aleksander351 if the issue you are experiencing is the same as the one you referenced, have you opened a ticket with that respective project? Ionic Framework is not responsible for breakages in Angular or packages used by Angular. That team would the best to report the issue to, especially if they've addressed a similar issue in the past. |
Ionic is dependent on Angular, not Angular on Ionic. (IF Ionic want's to continue to support Angular of course). If Angular doesn't use strict null checks, so shouldn't Ionic. Angular didn't break anything, Ionic was not and continues to not play well with Angular. Don't even get me started on SSR and Hydration. After all, the mountain didn't come to Mohammad. I hope this wasn't too much of a rant. I understand it's difficult to keep up with their changes. Now if they decide to ditch zone, I don't imagine Ionic keeps depending on zone. |
Is there at least an option to turn those logs off?
|
External changes made by Angular or dependencies of Angular that impact the compatibility of features such as web components are not Ionic's responsibility. This includes the usage of domino for Angular's earlier iterations of SSR or Angular's new SSR strategy that is not compatible with Ionic Framework and we (both Angular and Ionic Framework teams) have no plans of supporting.
I don't mind the feedback. I'm no longer on the team that maintains this project, I just volunteer and jump in to try and help provide responses and information that may help with the resolution. In this case, the issue you referenced the team had acknowledged it needed to be resolved externally. The request for suppressing Ionic's warnings has come up a number of times and I do agree that should be revisited. Especially in the case of CI/test environments, warnings should be suppressed through the Ionic config. Let me ask the question internally with the team and see if they would have an interest in supporting this configuration. |
After speaking with the team, we are going to log this as a feature request. We'd like to introduce a new option on the config that lets developers specify which log level they want to print. All messages at or above that severity would be logged. e.g.: provideIonicAngular({
logLevel: 'OFF', // 'WARNING', 'INFO', 'ERROR', 'OFF'
}) Default would match the log levels today, which would be The implementation would check the log level in the existing utility functions that Ionic Framework uses for logging messages: https://github.com/ionic-team/ionic-framework/blob/main/core/src/utils/logging/index.ts e.g.: import { config } from "@global/config";
export const printIonWarning = (message: string, ...params: any[]) => {
if (config.get("logLevel") === "WARNING" || config.get("logLevel") === "ERROR") {
return console.warn(`[Ionic Warning]: ${message}`, ...params);
}
}; Honestly would prefer something a little more condensed we can reuse across the functions. An enum or numeric log level may work best. Contributions are welcome if this feature speaks to you 😆 |
Thanks for the effort. The reason I closed it is because it's refering to versions of Ionic that probably won't be maintained in the future. The problem, in my case at least, is there for quite a while now. Like mentioned before, I could get rid of the problem by patching the supposedly responsible domino library. With the update of Angular to 17, there is no domino dependency anymore and the long error messages came right back. |
There is a --no-interactive flag already. You think I might use something like that? But I am not using the Ionic Cli to build the ssr App. Not sure if that's even possible. |
Used patch-package and manually removed all |
Prerequisites
Ionic Framework Version
v7.x
Current Behavior
I am (still) getting an endless error message which doesn't describe what the problem actually is.
this was the old issue, which was apparently caused by domino.
#27564
Now, after upgrading Angular from 15.2.9 to 16.2.12, the domino library is not present in node_modules anymore. But the error message is back again.
Another problem below is with the labelText.
It looks like label="" is a mandatory attribute of ion-select.
If I only provide the aria-label attribute, like the documentation suggests, I get the above error.
So, I got it working with an empty label="" and some CSS hacks.
Expected Behavior
there are no errors in the console after Ionic update.
ion-select works without the label attribute.
Steps to Reproduce
Everything is already described here.
#27564
Code Reproduction URL
https://github.com/aleksander351/ionic7-ssr-basic
Ionic Info
Ionic:
Ionic CLI : 6.12.3 (C:\Users\alex\AppData\Roaming\npm\node_modules@ionic\cli)
Ionic Framework : not installed
@angular-devkit/build-angular : 16.2.14
@angular-devkit/schematics : 16.2.14
@angular/cli : 16.2.14
@ionic/angular-toolkit : 9.0.0
Capacitor:
Capacitor CLI : 5.7.8
@capacitor/core : 5.7.8
Utility:
cordova-res : not installed
native-run : 2.0.1
System:
NodeJS : v20.14.0 (C:\Program Files\nodejs\node.exe)
npm : 10.8.1
OS : Windows 10
Additional Information
No response
The text was updated successfully, but these errors were encountered: