Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
phsl
/
new-api
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Snippets
Members
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit
3d529b4e
authored
Feb 04, 2026
by
Seefs
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
feat: capture request_id, filter by request_id, show request_conversion
parent
a6a0e694
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
4 additions
and
2 deletions
+4
-2
model/log.go
+4
-2
No files found.
model/log.go
View file @
3d529b4e
...
...
@@ -102,6 +102,7 @@ func RecordErrorLog(c *gin.Context, userId int, channelId int, modelName string,
isStream
bool
,
group
string
,
other
map
[
string
]
interface
{})
{
logger
.
LogInfo
(
c
,
fmt
.
Sprintf
(
"record error log: userId=%d, channelId=%d, modelName=%s, tokenName=%s, content=%s"
,
userId
,
channelId
,
modelName
,
tokenName
,
content
))
username
:=
c
.
GetString
(
"username"
)
requestId
:=
c
.
GetString
(
common
.
RequestIdKey
)
otherStr
:=
common
.
MapToJsonStr
(
other
)
// 判断是否需要记录 IP
needRecordIp
:=
false
...
...
@@ -132,7 +133,7 @@ func RecordErrorLog(c *gin.Context, userId int, channelId int, modelName string,
}
return
""
}(),
RequestId
:
c
.
GetString
(
common
.
RequestIdKey
)
,
RequestId
:
requestId
,
Other
:
otherStr
,
}
err
:=
LOG_DB
.
Create
(
log
)
.
Error
...
...
@@ -162,6 +163,7 @@ func RecordConsumeLog(c *gin.Context, userId int, params RecordConsumeLogParams)
}
logger
.
LogInfo
(
c
,
fmt
.
Sprintf
(
"record consume log: userId=%d, params=%s"
,
userId
,
common
.
GetJsonString
(
params
)))
username
:=
c
.
GetString
(
"username"
)
requestId
:=
c
.
GetString
(
common
.
RequestIdKey
)
otherStr
:=
common
.
MapToJsonStr
(
params
.
Other
)
// 判断是否需要记录 IP
needRecordIp
:=
false
...
...
@@ -192,7 +194,7 @@ func RecordConsumeLog(c *gin.Context, userId int, params RecordConsumeLogParams)
}
return
""
}(),
RequestId
:
c
.
GetString
(
common
.
RequestIdKey
)
,
RequestId
:
requestId
,
Other
:
otherStr
,
}
err
:=
LOG_DB
.
Create
(
log
)
.
Error
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment