Skip to content

Conversation

@mpscholten
Copy link
Member

Summary

  • Simplify Logger from a 5-field record (write, level, formatter, timeCache, cleanup) to a 2-field record (log, level) — the log closure bakes in level checking, formatting, and time caching at construction time
  • Remove LoggerSettings, its Default instance, and defaultDestination in favor of explicit newLogger arguments and a new configureLogger config helper
  • Handle cleanup via bracket (withLogger/withDefaultLogger) instead of storing it on the Logger, with buildFrameworkConfig threading cleanup out as IO (FrameworkConfig, IO ())

Test plan

  • IHP/Log/Types.hs compiles standalone via ghci
  • Full test suite passes (357 examples, 0 failures)

🤖 Generated with Claude Code

Simplify Logger from a 5-field record (write, level, formatter,
timeCache, cleanup) to a 2-field record (log, level). The log closure
bakes in level checking, formatting, and time caching at construction
time. Cleanup is handled externally via bracket rather than stored on
the Logger itself.

- Remove LoggerSettings, its Default instance, and defaultDestination
- newLogger takes 4 explicit args, returns (Logger, IO ()) tuple
- Add withLogger/withDefaultLogger for bracket-style resource management
- Add configureLogger helper for user-facing config in Config.hs
- buildFrameworkConfig returns (FrameworkConfig, IO ()) to thread cleanup
- Update all call sites: ScriptSupport, Migrate, DevServer, Migrations,
  ModelSupport, SchemaMigration, Hspec, Mocking, and test files
- Update Guide/logging.markdown for new API

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
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