Your ROOT_URL in app.ini is http://git.slaventius.ru/ but you are visiting http://37.143.12.169/test3k/umate/src/commit/bf21e2057702763eca0df0569f4a5b1c88f823d1/pkg/logger/logger.go You should set ROOT_URL correctly, otherwise the web may not work correctly.

45 lines
803 B

package logger
import (
"log"
"time"
"github.com/evalphobia/logrus_sentry"
"github.com/sirupsen/logrus"
)
type Logger struct {
*logrus.Logger
}
func NewLogger(appSource string, dsn string) *Logger {
logger := logrus.New()
logger.SetReportCaller(true) // Добавим отображение строки
//
if dsn == "" {
logger.Warn("sentry dsn is empty, its use is not possible")
} else {
if hook, err := logrus_sentry.NewSentryHook(dsn, []logrus.Level{
logrus.PanicLevel,
logrus.FatalLevel,
logrus.ErrorLevel,
}); err != nil {
log.Fatal(err)
} else {
//
tags := make(map[string]string)
tags["app"] = appSource
hook.Timeout = 1 * time.Second
hook.SetTagsContext(tags)
//
logger.Hooks.Add(hook)
}
}
return &Logger{
Logger: logger,
}
}