Skip to content

Commit 2328d03

Browse files
committed
add: tag
1 parent 87486d6 commit 2328d03

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

type_request.go

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ import (
66
uuid "github.com/satori/go.uuid"
77
"github.com/sirupsen/logrus"
88
"os"
9+
"strings"
910
"time"
1011
)
1112

@@ -84,6 +85,12 @@ func (b Request) Handler(entry *logrus.Entry) (*entries, []tag) {
8485
b.Method = ginCtx.Request.Method
8586
b.ResponseStatus = ginCtx.Writer.Status()
8687

88+
uriPath := ginCtx.FullPath()
89+
uriPathIndex := strings.Index(uriPath, "?")
90+
if uriPathIndex > 0 {
91+
uriPath = uriPath[0:uriPathIndex]
92+
}
93+
8794
return &entries{
8895
Uuid: uuId,
8996
BatchId: NewtelescopeHook().TelescopeUUID(),
@@ -92,5 +99,5 @@ func (b Request) Handler(entry *logrus.Entry) (*entries, []tag) {
9299
Type: b.BindType(),
93100
Content: ToContent(b),
94101
CreatedAt: time.Now().Format("2006-01-02 15:04:05"),
95-
}, []tag{{Tag: ginCtx.FullPath(), EntryUuid: uuId}}
102+
}, []tag{{Tag: uriPath, EntryUuid: uuId}}
96103
}

0 commit comments

Comments
 (0)