Skip to content

Conversation

@mbarta
Copy link
Collaborator

@mbarta mbarta commented Aug 21, 2025

This PR drops the debugLoggingEnabled config flag and instead allows client apps to set their own HotwireLogger implementation.

The default DefaultHotwireLogger logs debug messages to Logcat based on the BuildConfig.DEBUG value and always logs warnings and errors. If clients need to handle debug logging differently or require logging to other destinations (file, Sentry, etc.), they should provide their own implementation of HotwireLogger and set it in the Hotwire.config.

@mbarta mbarta self-assigned this Aug 21, 2025
@mbarta mbarta requested review from jayohms and jhutarek August 21, 2025 15:43
@mbarta mbarta marked this pull request as ready for review August 21, 2025 15:43
Copy link

@jhutarek jhutarek left a comment

Choose a reason for hiding this comment

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

Thanks! I'd consider a couple of tweaks. 🙏

@zoejessica
Copy link

I started a draft PR to update the website here: hotwired/hotwire-native-site#91

* main:
  Add Session tests to cover visits with restorationIdentifier logic
  Fix restorationIdentifier + "restore" logic so that "replace" visit actions don't get unintentionally rewritten
  Fix test formatting
  Bring back the synethic current visit restore approach, since turbo.js does not always play nicely with same-page "restore" visits
  Fix documentation
  Maintain same-page "restore" visits and dispatch a custom event so the web bridge library can be notified when this occurs
  Fix restoring a web visit after visiting a native screen by manually caching a snapshot when leavin the web screen.
…t what the application wants logged. This also allows consumers to change the log level without writing a full custom logger implementation.
@jayohms
Copy link
Contributor

jayohms commented Nov 6, 2025

@mbarta @jhutarek Please take a look at the latest changes. By introducing a HotwireLogLevel into the HotwireLogger interface, we no longer need to make assumptions about what to log. We don't log anything by default. The consumer can explicitly set the Hotwire.config.logger.logLevel in their application without having to write a custom HotwireLogger implementation.

@mbarta
Copy link
Collaborator Author

mbarta commented Nov 7, 2025

Happy with the latest changes @jayohms! It's closer to a standard logger implementation where you can set the desired log level for the default logger while still being able to provide your own if more customisation is needed 👍 Thanks!

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

Labels

None yet

Development

Successfully merging this pull request may close these issues.

5 participants