Skip to content
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

Expose ZoneSpecification parameters for package stack_trace #1949

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

feinstein
Copy link

@feinstein feinstein commented Dec 24, 2024

Reopening after dart-lang/stack_trace#167 was closed because of the repo's migration.

Closes #1864 exposing several parameters from the ZoneSpecification for the package stack_trace.

This change will allow apps to have more control over the ZoneSpecification they need, when using the stack_trace package. For example, for security reasons many apps will override the PrintHandler, so no prints are exposed in production, but currently it's impossible to do it when using this package.

This is actually the main reason why I submitted this PR, but since I was at it, I thought it would be better to expose all other missing parameters, in case others need them.

@feinstein
Copy link
Author

@devoncarew @lrhn I migrated this PR from the old repo, I would appreciate if you could review this, as the only reason why I don't use the stack_trace package in my app it's because I can't override the PrintHandler, and I have to do it for security reasons, so no prints are exposed in production.

Since I was going to expose the PrintHandler, I thought it would be better to just expose all the others, if anyone else needs them.

@feinstein feinstein changed the title Expose ZoneSpecification parameters Expose ZoneSpecification parameters for package stack_trace Dec 24, 2024
@lrhn
Copy link
Member

lrhn commented Dec 24, 2024

I'm not sure this is necessary.
If you do:

runZoned(
  zoneSpecification: someSpec,
  () => capture(...));

it should create a zone with all the overrides you want, and then a nested zone for capturing stack traces, which only has access to what that parent zone exposes.

@feinstein
Copy link
Author

feinstein commented Dec 24, 2024

Does this work with guarded zones too? Because I need to intercept exceptions and prints.

Does nesting zones introduce any performance impacts?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Expose the ZoneSpecification print handler
2 participants