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

Set up default environment and logger instances #139

Merged
merged 3 commits into from
Dec 28, 2024
Merged

Set up default environment and logger instances #139

merged 3 commits into from
Dec 28, 2024

Conversation

pepicrft
Copy link
Contributor

Based on our experience building Tuist, I'm adding two instances:

  • Logger: To leave execution traces that are useful for debugging.
  • Environment: A read interface that can be mocked in tests to isolate test executions.

Those instances are passed down using tasks locals via swift-service-context

@pepicrft pepicrft self-assigned this Dec 24, 2024
@@ -0,0 +1,16 @@
import ServiceContextModule

enum EnvironmentKey: Sendable, ServiceContextKey {
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The EnvironmentKey enum needs to be marked as public to allow external modules to create custom ServiceContext instances. Consider changing to:

public enum EnvironmentKey

Spotted by Graphite Reviewer

Is this helpful? React 👍 or 👎 to let us know.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's not necessary because a getter is provided through the extension below.

@pepicrft pepicrft merged commit 1875fd1 into main Dec 28, 2024
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant