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
be9f3be7
Commit
be9f3be7
authored
Dec 19, 2014
by
Daniel Smith
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
better logging
parent
5807b3d6
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
5 additions
and
5 deletions
+5
-5
request.go
pkg/client/request.go
+3
-3
log.go
pkg/httplog/log.go
+2
-2
No files found.
pkg/client/request.go
View file @
be9f3be7
...
@@ -62,7 +62,7 @@ type UnexpectedStatusError struct {
...
@@ -62,7 +62,7 @@ type UnexpectedStatusError struct {
// Error returns a textual description of 'u'.
// Error returns a textual description of 'u'.
func
(
u
*
UnexpectedStatusError
)
Error
()
string
{
func
(
u
*
UnexpectedStatusError
)
Error
()
string
{
return
fmt
.
Sprintf
(
"request [%
#
v] failed (%d) %s: %s"
,
u
.
Request
,
u
.
Response
.
StatusCode
,
u
.
Response
.
Status
,
u
.
Body
)
return
fmt
.
Sprintf
(
"request [%
+
v] failed (%d) %s: %s"
,
u
.
Request
,
u
.
Response
.
StatusCode
,
u
.
Response
.
Status
,
u
.
Body
)
}
}
// RequestConstructionError is returned when there's an error assembling a request.
// RequestConstructionError is returned when there's an error assembling a request.
...
@@ -242,7 +242,7 @@ func (r *Request) Body(obj interface{}) *Request {
...
@@ -242,7 +242,7 @@ func (r *Request) Body(obj interface{}) *Request {
}
}
r
.
body
=
bytes
.
NewBuffer
(
data
)
r
.
body
=
bytes
.
NewBuffer
(
data
)
default
:
default
:
r
.
err
=
fmt
.
Errorf
(
"unknown type used for body: %
#
v"
,
obj
)
r
.
err
=
fmt
.
Errorf
(
"unknown type used for body: %
+
v"
,
obj
)
}
}
return
r
return
r
}
}
...
@@ -309,7 +309,7 @@ func (r *Request) Watch() (watch.Interface, error) {
...
@@ -309,7 +309,7 @@ func (r *Request) Watch() (watch.Interface, error) {
if
resp
.
Body
!=
nil
{
if
resp
.
Body
!=
nil
{
body
,
_
=
ioutil
.
ReadAll
(
resp
.
Body
)
body
,
_
=
ioutil
.
ReadAll
(
resp
.
Body
)
}
}
return
nil
,
fmt
.
Errorf
(
"for request '%v', got status: %v
\n
body: %v"
,
req
.
URL
,
resp
.
StatusCode
,
string
(
body
))
return
nil
,
fmt
.
Errorf
(
"for request '%
+
v', got status: %v
\n
body: %v"
,
req
.
URL
,
resp
.
StatusCode
,
string
(
body
))
}
}
return
watch
.
NewStreamWatcher
(
watchjson
.
NewDecoder
(
resp
.
Body
,
r
.
codec
)),
nil
return
watch
.
NewStreamWatcher
(
watchjson
.
NewDecoder
(
resp
.
Body
,
r
.
codec
)),
nil
}
}
...
...
pkg/httplog/log.go
View file @
be9f3be7
...
@@ -168,8 +168,8 @@ func (rl *respLogger) Write(b []byte) (int, error) {
...
@@ -168,8 +168,8 @@ func (rl *respLogger) Write(b []byte) (int, error) {
func
(
rl
*
respLogger
)
Flush
()
{
func
(
rl
*
respLogger
)
Flush
()
{
if
flusher
,
ok
:=
rl
.
w
.
(
http
.
Flusher
);
ok
{
if
flusher
,
ok
:=
rl
.
w
.
(
http
.
Flusher
);
ok
{
flusher
.
Flush
()
flusher
.
Flush
()
}
else
{
}
else
if
glog
.
V
(
2
)
{
glog
.
V
(
2
)
.
Infof
(
"Unable to convert %v into http.Flusher"
,
rl
.
w
)
glog
.
InfoDepth
(
1
,
fmt
.
Sprintf
(
"Unable to convert %+v into http.Flusher"
,
rl
.
w
)
)
}
}
}
}
...
...
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