tcp.ac/util.go

15 lines
294 B
Go
Raw Normal View History

2021-02-15 20:52:35 +00:00
package main
import (
2021-04-24 05:31:18 +00:00
"github.com/gin-gonic/gin"
2021-09-01 07:19:10 +00:00
"github.com/rs/zerolog/log"
2021-02-15 20:52:35 +00:00
)
2022-01-21 12:58:22 +00:00
func errThrow(c *gin.Context, respcode int, thrown error, msg string) {
log.Error().
Str("IP", c.ClientIP()).
Str("User-Agent", c.GetHeader("User-Agent")).
Err(thrown).Msg(msg)
c.String(respcode, msg)
2021-02-15 20:52:35 +00:00
}