package utils

import (
	"crm-api/pkg/lfshook"
	"os"
	"os/signal"
	"syscall"
)

func Exit() {
	sigs := make(chan os.Signal, 1)
	done := make(chan bool, 1)
	// syscall.SIGSTOP windows not support
	signal.Notify(sigs, syscall.SIGINT, syscall.SIGTERM)
	go func() {
		<-sigs
		done <- true
	}()
	lfshook.NewLogger().Info("Server Start Awaiting Signal")
	<-done
	lfshook.NewLogger().Info("Exiting")
}
