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

WasiPreview1 takes an explicit logger to instantiate #604

Closed
evacchi opened this issue Oct 24, 2024 · 1 comment · Fixed by #717
Closed

WasiPreview1 takes an explicit logger to instantiate #604

evacchi opened this issue Oct 24, 2024 · 1 comment · Fixed by #717
Assignees

Comments

@evacchi
Copy link
Collaborator

evacchi commented Oct 24, 2024

  • We should allow users to instantiate WasiPreview without an explicit logger.
  • As a follow-up question, possibly answered contextually to this issue, should we have a global SystemLogger public default instance? I would argue we should.

So, instead of having users to specify new SystemLogger(); the SystemLogger would:

public class SystemLogger
    private static SystemLogger DEFAULT_LOGGER = new SystemLogger();
    public static getDefaultLogger() {
        return DEFAULT_LOGGER;
    }
...

then WasiPreview1 could expose an empty constructor:

public class WasiPreview1 {
    ...
    public WasiPreview1() {
        this(SystemLogger.getDefaultLogger());
    }

}
@evacchi evacchi self-assigned this Oct 24, 2024
@andreaTP
Copy link
Collaborator

In most places in this codebase, we locked down the instantiation of objects using builders, one option is to do the same in this context offering a consistent API experience to users.

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 a pull request may close this issue.

2 participants