Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: lmittmann/tint
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: v1.1.1
Choose a base ref
...
head repository: lmittmann/tint
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: v1.1.2
Choose a head ref
  • 1 commit
  • 3 files changed
  • 2 contributors

Commits on Jun 7, 2025

  1. Fix cloned handlers to use same mutex (#97)

    * test: Test cloned handlers synchronize writer writers
    
    All handlers cloned from the handler attached to a logger should synchronize writer writes. This allows the logger to be used from multiple go routines.
    
    Here we add a test writing to a `bytes.Buffer` which itself is in not synchronized to expose the problem.
    
    * fix: Cloned handlers use the same mutex
    
    Drawing on the information in https://github.com/golang/example/blob/8b405629c4a5215871be932097e099c05ec5cb2e/slog-handler-guide/README.md#concurrency-safety, the handler is adapted to store a pointer to a mutex so that it and all of its clones synchronize with each other.
    
    * workflows: test with `-race`
    
    * added comment
    
    * small cleanup
    
    ---------
    
    Co-authored-by: lmittmann <lmittmann@users.noreply.github.com>
    arthurpitman and lmittmann authored Jun 7, 2025
    Configuration menu
    Copy the full SHA
    401cb97 View commit details
    Browse the repository at this point in the history
Loading