Commit d8d7cc75 authored by Jeromy's avatar Jeromy

extract logging

License: MIT
Signed-off-by: default avatarJeromy <jeromyj@gmail.com>
parent 172cd15e
...@@ -18,8 +18,8 @@ import ( ...@@ -18,8 +18,8 @@ import (
pb "github.com/ipfs/go-ipfs/routing/dht/pb" pb "github.com/ipfs/go-ipfs/routing/dht/pb"
kb "github.com/ipfs/go-ipfs/routing/kbucket" kb "github.com/ipfs/go-ipfs/routing/kbucket"
record "github.com/ipfs/go-ipfs/routing/record" record "github.com/ipfs/go-ipfs/routing/record"
"github.com/ipfs/go-ipfs/thirdparty/eventlog"
u "github.com/ipfs/go-ipfs/util" u "github.com/ipfs/go-ipfs/util"
logging "github.com/ipfs/go-ipfs/vendor/go-log-v1.0.0"
proto "github.com/ipfs/go-ipfs/Godeps/_workspace/src/github.com/gogo/protobuf/proto" proto "github.com/ipfs/go-ipfs/Godeps/_workspace/src/github.com/gogo/protobuf/proto"
ds "github.com/ipfs/go-ipfs/Godeps/_workspace/src/github.com/jbenet/go-datastore" ds "github.com/ipfs/go-ipfs/Godeps/_workspace/src/github.com/jbenet/go-datastore"
...@@ -28,7 +28,7 @@ import ( ...@@ -28,7 +28,7 @@ import (
context "github.com/ipfs/go-ipfs/Godeps/_workspace/src/golang.org/x/net/context" context "github.com/ipfs/go-ipfs/Godeps/_workspace/src/golang.org/x/net/context"
) )
var log = eventlog.Logger("dht") var log = logging.Logger("dht")
var ProtocolDHT protocol.ID = "/ipfs/dht" var ProtocolDHT protocol.ID = "/ipfs/dht"
...@@ -98,7 +98,7 @@ func (dht *IpfsDHT) LocalPeer() peer.ID { ...@@ -98,7 +98,7 @@ func (dht *IpfsDHT) LocalPeer() peer.ID {
} }
// log returns the dht's logger // log returns the dht's logger
func (dht *IpfsDHT) log() eventlog.EventLogger { func (dht *IpfsDHT) log() logging.EventLogger {
return log // TODO rm return log // TODO rm
} }
......
...@@ -6,10 +6,10 @@ import ( ...@@ -6,10 +6,10 @@ import (
key "github.com/ipfs/go-ipfs/blocks/key" key "github.com/ipfs/go-ipfs/blocks/key"
inet "github.com/ipfs/go-ipfs/p2p/net" inet "github.com/ipfs/go-ipfs/p2p/net"
peer "github.com/ipfs/go-ipfs/p2p/peer" peer "github.com/ipfs/go-ipfs/p2p/peer"
eventlog "github.com/ipfs/go-ipfs/thirdparty/eventlog" logging "github.com/ipfs/go-ipfs/vendor/go-log-v1.0.0"
) )
var log = eventlog.Logger("dht.pb") var log = logging.Logger("dht.pb")
type PeerRoutingInfo struct { type PeerRoutingInfo struct {
peer.PeerInfo peer.PeerInfo
......
...@@ -8,10 +8,10 @@ import ( ...@@ -8,10 +8,10 @@ import (
peer "github.com/ipfs/go-ipfs/p2p/peer" peer "github.com/ipfs/go-ipfs/p2p/peer"
queue "github.com/ipfs/go-ipfs/p2p/peer/queue" queue "github.com/ipfs/go-ipfs/p2p/peer/queue"
"github.com/ipfs/go-ipfs/routing" "github.com/ipfs/go-ipfs/routing"
eventlog "github.com/ipfs/go-ipfs/thirdparty/eventlog"
u "github.com/ipfs/go-ipfs/util" u "github.com/ipfs/go-ipfs/util"
pset "github.com/ipfs/go-ipfs/util/peerset" pset "github.com/ipfs/go-ipfs/util/peerset"
todoctr "github.com/ipfs/go-ipfs/util/todocounter" todoctr "github.com/ipfs/go-ipfs/util/todocounter"
logging "github.com/ipfs/go-ipfs/vendor/go-log-v1.0.0"
process "github.com/ipfs/go-ipfs/Godeps/_workspace/src/github.com/jbenet/goprocess" process "github.com/ipfs/go-ipfs/Godeps/_workspace/src/github.com/jbenet/goprocess"
ctxproc "github.com/ipfs/go-ipfs/Godeps/_workspace/src/github.com/jbenet/goprocess/context" ctxproc "github.com/ipfs/go-ipfs/Godeps/_workspace/src/github.com/jbenet/goprocess/context"
...@@ -77,7 +77,7 @@ type dhtQueryRunner struct { ...@@ -77,7 +77,7 @@ type dhtQueryRunner struct {
errs u.MultiErr // result errors. maybe should be a map[peer.ID]error errs u.MultiErr // result errors. maybe should be a map[peer.ID]error
rateLimit chan struct{} // processing semaphore rateLimit chan struct{} // processing semaphore
log eventlog.EventLogger log logging.EventLogger
proc process.Process proc process.Process
sync.RWMutex sync.RWMutex
......
...@@ -8,10 +8,10 @@ import ( ...@@ -8,10 +8,10 @@ import (
"time" "time"
peer "github.com/ipfs/go-ipfs/p2p/peer" peer "github.com/ipfs/go-ipfs/p2p/peer"
u "github.com/ipfs/go-ipfs/util" logging "github.com/ipfs/go-ipfs/vendor/go-log-v1.0.0"
) )
var log = u.Logger("table") var log = logging.Logger("table")
// RoutingTable defines the routing table. // RoutingTable defines the routing table.
type RoutingTable struct { type RoutingTable struct {
......
...@@ -10,11 +10,11 @@ import ( ...@@ -10,11 +10,11 @@ import (
key "github.com/ipfs/go-ipfs/blocks/key" key "github.com/ipfs/go-ipfs/blocks/key"
peer "github.com/ipfs/go-ipfs/p2p/peer" peer "github.com/ipfs/go-ipfs/p2p/peer"
routing "github.com/ipfs/go-ipfs/routing" routing "github.com/ipfs/go-ipfs/routing"
u "github.com/ipfs/go-ipfs/util"
"github.com/ipfs/go-ipfs/util/testutil" "github.com/ipfs/go-ipfs/util/testutil"
logging "github.com/ipfs/go-ipfs/vendor/go-log-v1.0.0"
) )
var log = u.Logger("mockrouter") var log = logging.Logger("mockrouter")
type client struct { type client struct {
datastore ds.Datastore datastore ds.Datastore
......
...@@ -9,10 +9,10 @@ import ( ...@@ -9,10 +9,10 @@ import (
p2phost "github.com/ipfs/go-ipfs/p2p/host" p2phost "github.com/ipfs/go-ipfs/p2p/host"
peer "github.com/ipfs/go-ipfs/p2p/peer" peer "github.com/ipfs/go-ipfs/p2p/peer"
routing "github.com/ipfs/go-ipfs/routing" routing "github.com/ipfs/go-ipfs/routing"
u "github.com/ipfs/go-ipfs/util" logging "github.com/ipfs/go-ipfs/vendor/go-log-v1.0.0"
) )
var log = u.Logger("mockrouter") var log = logging.Logger("mockrouter")
type nilclient struct { type nilclient struct {
} }
......
...@@ -13,10 +13,10 @@ import ( ...@@ -13,10 +13,10 @@ import (
routing "github.com/ipfs/go-ipfs/routing" routing "github.com/ipfs/go-ipfs/routing"
pb "github.com/ipfs/go-ipfs/routing/dht/pb" pb "github.com/ipfs/go-ipfs/routing/dht/pb"
record "github.com/ipfs/go-ipfs/routing/record" record "github.com/ipfs/go-ipfs/routing/record"
eventlog "github.com/ipfs/go-ipfs/thirdparty/eventlog" logging "github.com/ipfs/go-ipfs/vendor/go-log-v1.0.0"
) )
var log = eventlog.Logger("offlinerouting") var log = logging.Logger("offlinerouting")
var ErrOffline = errors.New("routing system in offline mode") var ErrOffline = errors.New("routing system in offline mode")
......
...@@ -9,11 +9,11 @@ import ( ...@@ -9,11 +9,11 @@ import (
dag "github.com/ipfs/go-ipfs/merkledag" dag "github.com/ipfs/go-ipfs/merkledag"
ci "github.com/ipfs/go-ipfs/p2p/crypto" ci "github.com/ipfs/go-ipfs/p2p/crypto"
pb "github.com/ipfs/go-ipfs/routing/dht/pb" pb "github.com/ipfs/go-ipfs/routing/dht/pb"
eventlog "github.com/ipfs/go-ipfs/thirdparty/eventlog" logging "github.com/ipfs/go-ipfs/vendor/go-log-v1.0.0"
) )
var _ = dag.FetchGraph var _ = dag.FetchGraph
var log = eventlog.Logger("routing/record") var log = logging.Logger("routing/record")
// MakePutRecord creates and signs a dht record for the given key/value pair // MakePutRecord creates and signs a dht record for the given key/value pair
func MakePutRecord(sk ci.PrivKey, key key.Key, value []byte, sign bool) (*pb.Record, error) { func MakePutRecord(sk ci.PrivKey, key key.Key, value []byte, sign bool) (*pb.Record, error) {
......
...@@ -14,10 +14,10 @@ import ( ...@@ -14,10 +14,10 @@ import (
routing "github.com/ipfs/go-ipfs/routing" routing "github.com/ipfs/go-ipfs/routing"
pb "github.com/ipfs/go-ipfs/routing/dht/pb" pb "github.com/ipfs/go-ipfs/routing/dht/pb"
proxy "github.com/ipfs/go-ipfs/routing/supernode/proxy" proxy "github.com/ipfs/go-ipfs/routing/supernode/proxy"
eventlog "github.com/ipfs/go-ipfs/thirdparty/eventlog" logging "github.com/ipfs/go-ipfs/vendor/go-log-v1.0.0"
) )
var log = eventlog.Logger("supernode") var log = logging.Logger("supernode")
type Client struct { type Client struct {
peerhost host.Host peerhost host.Host
...@@ -37,7 +37,7 @@ func NewClient(px proxy.Proxy, h host.Host, ps peer.Peerstore, local peer.ID) (* ...@@ -37,7 +37,7 @@ func NewClient(px proxy.Proxy, h host.Host, ps peer.Peerstore, local peer.ID) (*
} }
func (c *Client) FindProvidersAsync(ctx context.Context, k key.Key, max int) <-chan peer.PeerInfo { func (c *Client) FindProvidersAsync(ctx context.Context, k key.Key, max int) <-chan peer.PeerInfo {
ctx = eventlog.ContextWithLoggable(ctx, eventlog.Uuid("findProviders")) ctx = logging.ContextWithLoggable(ctx, logging.Uuid("findProviders"))
defer log.EventBegin(ctx, "findProviders", &k).Done() defer log.EventBegin(ctx, "findProviders", &k).Done()
ch := make(chan peer.PeerInfo) ch := make(chan peer.PeerInfo)
go func() { go func() {
......
...@@ -12,12 +12,12 @@ import ( ...@@ -12,12 +12,12 @@ import (
peer "github.com/ipfs/go-ipfs/p2p/peer" peer "github.com/ipfs/go-ipfs/p2p/peer"
dhtpb "github.com/ipfs/go-ipfs/routing/dht/pb" dhtpb "github.com/ipfs/go-ipfs/routing/dht/pb"
kbucket "github.com/ipfs/go-ipfs/routing/kbucket" kbucket "github.com/ipfs/go-ipfs/routing/kbucket"
eventlog "github.com/ipfs/go-ipfs/thirdparty/eventlog" logging "github.com/ipfs/go-ipfs/vendor/go-log-v1.0.0"
) )
const ProtocolSNR = "/ipfs/supernoderouting" const ProtocolSNR = "/ipfs/supernoderouting"
var log = eventlog.Logger("supernode/proxy") var log = logging.Logger("supernode/proxy")
type Proxy interface { type Proxy interface {
Bootstrap(context.Context) error Bootstrap(context.Context) error
...@@ -127,7 +127,7 @@ func (px *standard) SendRequest(ctx context.Context, m *dhtpb.Message) (*dhtpb.M ...@@ -127,7 +127,7 @@ func (px *standard) SendRequest(ctx context.Context, m *dhtpb.Message) (*dhtpb.M
} }
func (px *standard) sendRequest(ctx context.Context, m *dhtpb.Message, remote peer.ID) (*dhtpb.Message, error) { func (px *standard) sendRequest(ctx context.Context, m *dhtpb.Message, remote peer.ID) (*dhtpb.Message, error) {
e := log.EventBegin(ctx, "sendRoutingRequest", px.Host.ID(), remote, eventlog.Pair("request", m)) e := log.EventBegin(ctx, "sendRoutingRequest", px.Host.ID(), remote, logging.Pair("request", m))
defer e.Done() defer e.Done()
if err := px.Host.Connect(ctx, peer.PeerInfo{ID: remote}); err != nil { if err := px.Host.Connect(ctx, peer.PeerInfo{ID: remote}); err != nil {
e.SetError(err) e.SetError(err)
...@@ -157,8 +157,8 @@ func (px *standard) sendRequest(ctx context.Context, m *dhtpb.Message, remote pe ...@@ -157,8 +157,8 @@ func (px *standard) sendRequest(ctx context.Context, m *dhtpb.Message, remote pe
e.SetError(err) e.SetError(err)
return nil, err return nil, err
} }
e.Append(eventlog.Pair("response", response)) e.Append(logging.Pair("response", response))
e.Append(eventlog.Pair("uuid", eventlog.Uuid("foo"))) e.Append(logging.Pair("uuid", logging.Uuid("foo")))
return response, nil return response, nil
} }
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment