func main() {
	checker := health.NewChecker(
		health.WithTimeout(10*time.Second),
		health.WithCheck(health.Check{
			Name:           "database",
			Timeout:        2 * time.Second,  
			StatusListener: onComponentStatusChanged,
			Check: func(ctx context.Context) error {
				return nil  
			},
		}),
		health.WithCheck(health.Check{
			Name:           "filesystem",
			Timeout:        2 * time.Second,  
			StatusListener: onComponentStatusChanged,
			Check: func(ctx context.Context) error {
				return nil  
			},
		}),
		health.WithPeriodicCheck(5*time.Second, 10*time.Second, health.Check{
			Name:           "search-engine",
			StatusListener: onComponentStatusChanged,
			Check:          volatileFunc(),
		}),
		health.WithStatusListener(onSystemStatusChanged),
	)
	http.Handle("/health", health.NewHandler(checker))
	http.ListenAndServe(":3000", nil)
}
This example shows how this library can be used to listen for health status changes.
package main
import (
	"context"
	"fmt"
	"github.com/alexliesenfeld/health"
	"log"
	"net/http"
	"sync/atomic"
	"time"
)