Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
K
k3s
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Jacklull
k3s
Commits
3868417e
Commit
3868417e
authored
Dec 12, 2014
by
Daniel Smith
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #2917 from dchen1107/cleanup
Make httplog more useful by using glog.*Depth.
parents
a30b5f5f
83453bae
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
4 additions
and
2 deletions
+4
-2
log.go
pkg/httplog/log.go
+4
-2
No files found.
pkg/httplog/log.go
View file @
3868417e
...
@@ -63,7 +63,7 @@ type passthroughLogger struct{}
...
@@ -63,7 +63,7 @@ type passthroughLogger struct{}
// Addf logs info immediately.
// Addf logs info immediately.
func
(
passthroughLogger
)
Addf
(
format
string
,
data
...
interface
{})
{
func
(
passthroughLogger
)
Addf
(
format
string
,
data
...
interface
{})
{
glog
.
Info
f
(
format
,
data
...
)
glog
.
Info
Depth
(
1
,
fmt
.
Sprintf
(
format
,
data
...
)
)
}
}
// DefaultStacktracePred is the default implementation of StacktracePred.
// DefaultStacktracePred is the default implementation of StacktracePred.
...
@@ -148,7 +148,9 @@ func (rl *respLogger) Addf(format string, data ...interface{}) {
...
@@ -148,7 +148,9 @@ func (rl *respLogger) Addf(format string, data ...interface{}) {
// Log is intended to be called once at the end of your request handler, via defer
// Log is intended to be called once at the end of your request handler, via defer
func
(
rl
*
respLogger
)
Log
()
{
func
(
rl
*
respLogger
)
Log
()
{
latency
:=
time
.
Since
(
rl
.
startTime
)
latency
:=
time
.
Since
(
rl
.
startTime
)
glog
.
V
(
2
)
.
Infof
(
"%s %s: (%v) %v%v%v"
,
rl
.
req
.
Method
,
rl
.
req
.
RequestURI
,
latency
,
rl
.
status
,
rl
.
statusStack
,
rl
.
addedInfo
)
if
glog
.
V
(
2
)
{
glog
.
InfoDepth
(
1
,
fmt
.
Sprintf
(
"%s %s: (%v) %v%v%v"
,
rl
.
req
.
Method
,
rl
.
req
.
RequestURI
,
latency
,
rl
.
status
,
rl
.
statusStack
,
rl
.
addedInfo
))
}
}
}
// Header implements http.ResponseWriter.
// Header implements http.ResponseWriter.
...
...
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