Files
crawlab/core/utils/health.go
Marvin Zhang 3276083994 refactor: replace apex/log with structured logger across multiple services
- Replaced all instances of apex/log with a structured logger interface in various services, including Api, Server, Config, and others, to enhance logging consistency and context.
- Updated logging calls to utilize the new logger methods, improving error tracking and service monitoring.
- Added logger initialization in services and controllers to ensure proper logging setup.
- Improved error handling and logging messages for better clarity during service operations.
- Removed unused apex/log imports and cleaned up related code for better maintainability.
2024-12-24 19:11:19 +08:00

17 lines
351 B
Go

package utils
import (
"fmt"
"net/http"
)
func HandleHealthFn(healthFn func() bool, healthPort int) {
addr := fmt.Sprintf(":%d", healthPort)
go func() {
if err := http.ListenAndServe(addr, nil); err != nil {
logger.Errorf("health check server failed: %v", err)
}
}()
logger.Infof("health check server started on port %d", healthPort)
}