Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
What's new
10
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Open sidebar
dms3
go-dms3-cmds
Commits
9cfe137e
Commit
9cfe137e
authored
Jul 30, 2018
by
Jeromy
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
remove loggables dependency
parent
9a5c3cbf
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
12 additions
and
8 deletions
+12
-8
http/handler.go
http/handler.go
+12
-2
package.json
package.json
+0
-6
No files found.
http/handler.go
View file @
9cfe137e
...
...
@@ -2,6 +2,8 @@ package http
import
(
"context"
"crypto/rand"
"encoding/base32"
"errors"
"net/http"
"runtime/debug"
...
...
@@ -10,7 +12,6 @@ import (
cmds
"github.com/ipfs/go-ipfs-cmds"
logging
"github.com/ipfs/go-log"
"github.com/libp2p/go-libp2p-loggables"
cors
"github.com/rs/cors"
)
...
...
@@ -132,7 +133,7 @@ func (h *handler) ServeHTTP(w http.ResponseWriter, r *http.Request) {
}
defer
cancel
()
req
.
Context
=
logging
.
ContextWithLoggable
(
req
.
Context
,
l
oggable
s
.
Uuid
(
"requestId"
))
req
.
Context
=
logging
.
ContextWithLoggable
(
req
.
Context
,
uuidL
oggable
(
))
if
cn
,
ok
:=
w
.
(
http
.
CloseNotifier
);
ok
{
clientGone
:=
cn
.
CloseNotify
()
go
func
()
{
...
...
@@ -160,6 +161,15 @@ func (h *handler) ServeHTTP(w http.ResponseWriter, r *http.Request) {
h
.
root
.
Call
(
req
,
re
,
h
.
env
)
}
func
uuidLoggable
()
logging
.
Loggable
{
ids
:=
make
([]
byte
,
16
)
rand
.
Read
(
ids
)
return
logging
.
Metadata
{
"requestId"
:
base32
.
HexEncoding
.
EncodeToString
(
ids
),
}
}
func
sanitizedErrStr
(
err
error
)
string
{
s
:=
err
.
Error
()
s
=
strings
.
Split
(
s
,
"
\n
"
)[
0
]
...
...
package.json
View file @
9cfe137e
...
...
@@ -29,12 +29,6 @@
"name"
:
"go-ipfs-cmdkit"
,
"version"
:
"1.1.1"
},
{
"author"
:
"whyrusleeping"
,
"hash"
:
"QmRPkGkHLB72caXgdDYnoaWigXNWx95BcYDKV1n3KTEpaG"
,
"name"
:
"go-libp2p-loggables"
,
"version"
:
"1.1.18"
},
{
"author"
:
"texttheater"
,
"hash"
:
"QmTVvctiHWZzSDZdyU5wdnXh7VF3kprHSyQFwVChos5qKu"
,
...
...
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