Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
杨树贤
/
LC_soapi
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Snippets
Settings
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit
40b95f7b
authored
Jan 07, 2020
by
杨树贤
Browse files
Options
_('Browse Files')
Download
Email Patches
Plain Diff
记录请求日志
parent
7b68309b
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
18 additions
and
8 deletions
pkg/app/response.go → pkg/http/response.go
pkg/logging/log.go
pkg/logging/log_report.go
pkg/
ap
p/response.go
→
pkg/
htt
p/response.go
View file @
40b95f7b
File moved
pkg/logging/log.go
View file @
40b95f7b
package
logg
er
package
logg
ing
import
(
"LC_soapi/pkg/setting"
...
...
pkg/logging/log_report.go
View file @
40b95f7b
package
logg
er
package
logg
ing
import
(
"LC_soapi/pkg/setting"
"LC_soapi/pkg/util"
"encoding/json"
"fmt"
"github.com/ichunt2019/logger"
"time"
)
...
...
@@ -19,15 +22,22 @@ type ErrorLog struct {
}
//上报请求日志
func
ReportErrorLog
(
msg
string
,
code
int
,
method
string
)
{
func
ReportErrorLog
(
msg
string
,
code
int
,
method
string
,
ip
string
)
{
var
errLog
ErrorLog
caller
:=
util
.
GetCaller
(
2
);
fmt
.
Println
(
caller
)
//获取调用者信息
caller
:=
util
.
GetCaller
(
2
)
errLog
.
TimeStamp
=
int
(
time
.
Now
()
.
Unix
())
errLog
.
DateTimeStr
=
time
.
Now
()
.
Format
(
"2006-01-02 15:04:05"
)
errLog
.
App
=
"Search"
errLog
.
ServerIp
=
"127.0.0.1"
errLog
.
App
=
setting
.
AppSetting
.
Name
errLog
.
ServerIp
=
ip
errLog
.
Method
=
"g.G.Routes()"
errLog
.
FileName
=
caller
.
FileName
errLog
.
LineNo
=
caller
.
FileLine
logString
,
_
:=
json
.
Marshal
(
errLog
)
logger
.
Info
(
string
(
logString
))
fmt
.
Println
(
errLog
)
}
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