Stacked-Org / stacked

A Flutter application architecture created from real world scenarios
MIT License
957 stars 255 forks source link

[feature]: Customizable Logger Filters for StackedLogger #1098

Open camillo-rinaldi opened 5 months ago

camillo-rinaldi commented 5 months ago

Is your feature request related to a problem? Please describe.

The problem arises when trying to control log output in different environments using the StackedLogger class. Currently, there is no straightforward way to specify which logs are displayed in production versus development environments.

Describe the solution you would like

I propose adding functionality to the StackedLogger class that allows developers to specify a default log filter directly through the @StackedApp annotation. This would involve enhancing the logger setup to accept a filter parameter that determines which log messages are appropriate for different build variants or environments. For example:

@StackedApp(
  logger: StackedLogger(
    filter: MyCustomFilter(),
  ),
)

Additional Context

No response

FilledStacks commented 5 months ago

This is a good improvement request.

We currently only have disableReleaseConsoleOutput: property on the logger, which will disable logs in release mode, but only to console output.

If you have a custom logger you're passing in you can internally determine what to log as a workaround.

But I agree, this should be easier.