Skip to content

Commit

Permalink
fix logger
Browse files Browse the repository at this point in the history
  • Loading branch information
kdudkov committed Jan 14, 2025
1 parent 23aa3d2 commit 6293bd8
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 3 deletions.
1 change: 1 addition & 0 deletions cmd/goatak_server/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -341,6 +341,7 @@ func (app *App) route(msg *cot.CotMessage) bool {

if dest := msg.GetDetail().GetDestCallsign(); len(dest) > 0 {
for _, s := range dest {
app.logger.Info(fmt.Sprintf("point %s %s -> callsign %s", msg.GetUID(), msg.GetCallsign(), s))
app.sendToCallsign(s, msg)
}

Expand Down
1 change: 1 addition & 0 deletions cmd/goatak_server/mission_api.go
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ func addMissionApi(app *App, f fiber.Router) {
g.Get("/:missionname/cot", getMissionCotHandler(app))
g.Get("/:missionname/contacts", getMissionContactsHandler(app))
g.Put("/:missionname/contents", getMissionContentPutHandler(app))
//g.Put("/:missionname/contents/missionpackage", getMissionContentPutHandler(app))
g.Delete("/:missionname/contents", getMissionContentDeleteHandler(app))
g.Get("/:missionname/log", getMissionLogHandler(app))
g.Put("/:missionname/keywords", getMissionKeywordsPutHandler(app))
Expand Down
6 changes: 3 additions & 3 deletions pkg/log/fiber_logger.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,12 +27,10 @@ func NewFiberLogger(conf *LoggerConfig) fiber.Handler {
start := time.Now()
chainErr := c.Next()
wt := time.Since(start)
status := c.Response().StatusCode()

msg := fmt.Sprintf("%d %s %s %s", c.Response().StatusCode(), c.Method(), c.Path(), c.Request().URI().QueryArgs().String())
l := logger

status := c.Response().StatusCode()

if chainErr != nil {
var e *fiber.Error
if errors.As(chainErr, &e) {
Expand All @@ -42,6 +40,8 @@ func NewFiberLogger(conf *LoggerConfig) fiber.Handler {
l = l.With(slog.Any("error", chainErr))
}

msg := fmt.Sprintf("%d %s %s %s", status, c.Method(), c.Path(), c.Request().URI().QueryArgs().String())

var attrs []any
if conf.UserGetter != nil {
attrs = []any{
Expand Down

0 comments on commit 6293bd8

Please sign in to comment.