0

Logrus заменён на штатный log/slog, обновлены зависимости

This commit is contained in:
eleksir
2025-10-07 23:59:18 +03:00
parent e000489790
commit a49abdd715
380 changed files with 105 additions and 224708 deletions

View File

@@ -1,27 +1,27 @@
package misc
import (
"fmt"
"log/slog"
"os"
"syscall"
log "github.com/sirupsen/logrus"
)
// SigHandler хэндлер сигналов закрывает все бд и сваливает из приложения.
func SigHandler() {
var err error
log.Infoln("Install signal handler")
slog.Info("Install signal handler")
for {
var s = <-SigChan
switch s {
case syscall.SIGINT:
log.Infoln("Got SIGINT, quitting")
slog.Info("Got SIGINT, quitting")
case syscall.SIGTERM:
log.Infoln("Got SIGTERM, quitting")
slog.Info("Got SIGTERM, quitting")
case syscall.SIGQUIT:
log.Infoln("Got SIGQUIT, quitting")
slog.Info("Got SIGQUIT, quitting")
// Заходим на новую итерацию, если у нас "неинтересный" сигнал.
default:
@@ -33,11 +33,11 @@ func SigHandler() {
// Отпишемся от всех каналов и закроем коннект к редиске.
if err = Subscriber.Unsubscribe(Ctx); err != nil {
log.Errorf("Unable to unsubscribe from redis channels cleanly: %s", err)
slog.Error(fmt.Sprintf("Unable to unsubscribe from redis channels cleanly: %s", err))
}
if err = Subscriber.Close(); err != nil {
log.Errorf("Unable to close redis connection cleanly: %s", err)
slog.Error(fmt.Sprintf("Unable to close redis connection cleanly: %s", err))
}
os.Exit(0)