customer/cmd/app/main.go

44 lines
1.0 KiB
Go
Raw Normal View History

2023-05-16 01:12:07 +00:00
package main
import (
"context"
"fmt"
"os/signal"
"path"
"runtime"
"strconv"
"syscall"
formatter "github.com/antonfisher/nested-logrus-formatter"
"github.com/sirupsen/logrus"
2023-05-16 04:01:55 +00:00
"penahub.gitlab.yandexcloud.net/pena-services/customer/internal/app"
"penahub.gitlab.yandexcloud.net/pena-services/customer/internal/initialize"
2023-05-16 01:12:07 +00:00
)
func main() {
ctx, cancel := signal.NotifyContext(context.Background(), syscall.SIGINT, syscall.SIGTERM)
logger := logrus.New()
defer cancel()
logger.SetReportCaller(true)
logger.SetFormatter(&formatter.Formatter{
TimestampFormat: "02-01-2006 15:04:05",
HideKeys: true,
NoColors: false,
NoFieldsSpace: true,
CustomCallerFormatter: func(frame *runtime.Frame) string {
return fmt.Sprintf(" (%s:%s)", path.Base(frame.File), strconv.Itoa(frame.Line))
},
})
config, err := initialize.Configuration(".env.test")
if err != nil {
logger.Fatalf("failed to init config: %v", err)
}
if err := app.Run(ctx, config, logger); err != nil {
logger.Fatalf("failed to run app: %v", err)
}
}