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

feat: add onHotReloadLog #5

Merged
merged 2 commits into from Jun 13, 2022

Conversation

felangel
Copy link
Contributor

Description

As a developer, I want to be able to access any/all logs from the hotreloader so that I can fully customize the user facing logging experience. One use case is surfacing hotReload errors to users which is currently not possible.

This pull request adds an optional onHotReloadLog and a logLevel parameter which enable developers to configure the log level and intercept/handle any logs from the underlying hotreloader.

Example Usage

final myLogger = Logger();

withHotreload(
  () => createServer(),
  onReloaded: () => myLogger.log('Reload!'),
  onHotReloadNotAvailable: () => myLogger.log('No hot-reload :('),
  onHotReloadAvailable: () => myLogger.log('Yay! Hot-reload :)'),
  onHotReloadLog: (log) => myLogger.log('Reload Log: ${log.message}'),
  logLevel: Level.INFO,
);

@felixblaschke
Copy link
Owner

Nice. Looking good.

@felixblaschke felixblaschke merged commit 863e8b1 into felixblaschke:main Jun 13, 2022
@felixblaschke
Copy link
Owner

@felangel 1.3.0 got published.

@felangel
Copy link
Contributor Author

Thanks so much for the quick review and publish! 🚀

@felangel felangel deleted the feat/onHotReloadLog branch June 13, 2022 18:11
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.

None yet

2 participants