Browse Source

extract logging

License: MIT
Signed-off-by: Jeromy <jeromyj@gmail.com>
pull/2/head
Jeromy 9 years ago
parent
commit
983ed327ce
  1. 3
      crypto/key.go
  2. 4
      crypto/secio/protocol.go
  3. 4
      discovery/mdns.go
  4. 4
      host/basic/basic_host.go
  5. 4
      host/host.go
  6. 4
      host/routed/routed.go
  7. 4
      nat/nat.go
  8. 4
      net/conn/conn.go
  9. 4
      net/mock/mock.go
  10. 8
      net/swarm/addr/addr.go
  11. 4
      net/swarm/swarm.go
  12. 3
      peer/peer.go
  13. 4
      peer/queue/sync.go
  14. 4
      protocol/identify/id.go
  15. 4
      protocol/mux.go
  16. 4
      protocol/ping/ping.go
  17. 4
      protocol/relay/relay.go
  18. 4
      protocol/relay/relay_test.go
  19. 4
      test/backpressure/backpressure_test.go
  20. 4
      test/reconnects/reconnect_test.go
  21. 4
      test/util/key.go

3
crypto/key.go

@ -23,9 +23,10 @@ import (
pb "github.com/ipfs/go-ipfs/p2p/crypto/pb"
u "github.com/ipfs/go-ipfs/util"
logging "github.com/ipfs/go-ipfs/vendor/go-log-v1.0.0"
)
var log = u.Logger("crypto")
var log = logging.Logger("crypto")
var ErrBadKeyType = errors.New("invalid or unsupported key type")

4
crypto/secio/protocol.go

@ -14,11 +14,11 @@ import (
ci "github.com/ipfs/go-ipfs/p2p/crypto"
pb "github.com/ipfs/go-ipfs/p2p/crypto/secio/pb"
peer "github.com/ipfs/go-ipfs/p2p/peer"
eventlog "github.com/ipfs/go-ipfs/thirdparty/eventlog"
u "github.com/ipfs/go-ipfs/util"
logging "github.com/ipfs/go-ipfs/vendor/go-log-v1.0.0"
)
var log = eventlog.Logger("secio")
var log = logging.Logger("secio")
// ErrUnsupportedKeyType is returned when a private key cast/type switch fails.
var ErrUnsupportedKeyType = errors.New("unsupported key type")

4
discovery/mdns.go

@ -15,10 +15,10 @@ import (
"github.com/ipfs/go-ipfs/p2p/host"
"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("mdns")
var log = logging.Logger("mdns")
const ServiceTag = "discovery.ipfs.io"

4
host/basic/basic_host.go

@ -8,7 +8,7 @@ import (
context "github.com/ipfs/go-ipfs/Godeps/_workspace/src/golang.org/x/net/context"
metrics "github.com/ipfs/go-ipfs/metrics"
mstream "github.com/ipfs/go-ipfs/metrics/stream"
eventlog "github.com/ipfs/go-ipfs/thirdparty/eventlog"
logging "github.com/ipfs/go-ipfs/vendor/go-log-v1.0.0"
inet "github.com/ipfs/go-ipfs/p2p/net"
peer "github.com/ipfs/go-ipfs/p2p/peer"
@ -17,7 +17,7 @@ import (
relay "github.com/ipfs/go-ipfs/p2p/protocol/relay"
)
var log = eventlog.Logger("p2p/host/basic")
var log = logging.Logger("p2p/host/basic")
// Option is a type used to pass in options to the host.
type Option int

4
host/host.go

@ -7,10 +7,10 @@ import (
inet "github.com/ipfs/go-ipfs/p2p/net"
peer "github.com/ipfs/go-ipfs/p2p/peer"
protocol "github.com/ipfs/go-ipfs/p2p/protocol"
eventlog "github.com/ipfs/go-ipfs/thirdparty/eventlog"
logging "github.com/ipfs/go-ipfs/vendor/go-log-v1.0.0"
)
var log = eventlog.Logger("p2p/host")
var log = logging.Logger("p2p/host")
// Host is an object participating in a p2p network, which
// implements protocols or provides services. It handles

4
host/routed/routed.go

@ -6,7 +6,7 @@ import (
ma "github.com/ipfs/go-ipfs/Godeps/_workspace/src/github.com/jbenet/go-multiaddr"
context "github.com/ipfs/go-ipfs/Godeps/_workspace/src/golang.org/x/net/context"
eventlog "github.com/ipfs/go-ipfs/thirdparty/eventlog"
logging "github.com/ipfs/go-ipfs/vendor/go-log-v1.0.0"
lgbl "github.com/ipfs/go-ipfs/util/eventlog/loggables"
metrics "github.com/ipfs/go-ipfs/metrics"
@ -17,7 +17,7 @@ import (
routing "github.com/ipfs/go-ipfs/routing"
)
var log = eventlog.Logger("p2p/host/routed")
var log = logging.Logger("p2p/host/routed")
// AddressTTL is the expiry time for our addresses.
// We expire them quickly.

4
nat/nat.go

@ -14,8 +14,8 @@ import (
nat "github.com/ipfs/go-ipfs/Godeps/_workspace/src/github.com/fd/go-nat"
goprocess "github.com/ipfs/go-ipfs/Godeps/_workspace/src/github.com/jbenet/goprocess"
periodic "github.com/ipfs/go-ipfs/Godeps/_workspace/src/github.com/jbenet/goprocess/periodic"
eventlog "github.com/ipfs/go-ipfs/thirdparty/eventlog"
notifier "github.com/ipfs/go-ipfs/thirdparty/notifier"
logging "github.com/ipfs/go-ipfs/vendor/go-log-v1.0.0"
)
var (
@ -23,7 +23,7 @@ var (
ErrNoMapping = errors.New("mapping not established")
)
var log = eventlog.Logger("nat")
var log = logging.Logger("nat")
// MappingDuration is a default port mapping duration.
// Port mappings are renewed every (MappingDuration / 3)

4
net/conn/conn.go

@ -13,12 +13,12 @@ import (
context "github.com/ipfs/go-ipfs/Godeps/_workspace/src/golang.org/x/net/context"
ic "github.com/ipfs/go-ipfs/p2p/crypto"
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"
u "github.com/ipfs/go-ipfs/util"
lgbl "github.com/ipfs/go-ipfs/util/eventlog/loggables"
)
var log = eventlog.Logger("conn")
var log = logging.Logger("conn")
// ReleaseBuffer puts the given byte array back into the buffer pool,
// first verifying that it is the correct size

4
net/mock/mock.go

@ -1,12 +1,12 @@
package mocknet
import (
eventlog "github.com/ipfs/go-ipfs/thirdparty/eventlog"
logging "github.com/ipfs/go-ipfs/vendor/go-log-v1.0.0"
context "github.com/ipfs/go-ipfs/Godeps/_workspace/src/golang.org/x/net/context"
)
var log = eventlog.Logger("mocknet")
var log = logging.Logger("mocknet")
// WithNPeers constructs a Mocknet with N peers.
func WithNPeers(ctx context.Context, n int) (Mocknet, error) {

8
net/swarm/addr/addr.go

@ -3,14 +3,14 @@ package addrutil
import (
"fmt"
eventlog "github.com/ipfs/go-ipfs/thirdparty/eventlog"
logging "github.com/ipfs/go-ipfs/vendor/go-log-v1.0.0"
ma "github.com/ipfs/go-ipfs/Godeps/_workspace/src/github.com/jbenet/go-multiaddr"
manet "github.com/ipfs/go-ipfs/Godeps/_workspace/src/github.com/jbenet/go-multiaddr-net"
context "github.com/ipfs/go-ipfs/Godeps/_workspace/src/golang.org/x/net/context"
)
var log = eventlog.Logger("p2p/net/swarm/addr")
var log = logging.Logger("p2p/net/swarm/addr")
// SupportedTransportStrings is the list of supported transports for the swarm.
// These are strings of encapsulated multiaddr protocols. E.g.:
@ -176,12 +176,12 @@ func ResolveUnspecifiedAddresses(unspecAddrs, ifaceAddrs []ma.Multiaddr) ([]ma.M
return nil, fmt.Errorf("failed to specify addrs: %s", unspecAddrs)
}
log.Event(context.TODO(), "interfaceListenAddresses", func() eventlog.Loggable {
log.Event(context.TODO(), "interfaceListenAddresses", func() logging.Loggable {
var addrs []string
for _, addr := range outputAddrs {
addrs = append(addrs, addr.String())
}
return eventlog.Metadata{"addresses": addrs}
return logging.Metadata{"addresses": addrs}
}())
log.Debug("ResolveUnspecifiedAddresses:", unspecAddrs, ifaceAddrs, outputAddrs)

4
net/swarm/swarm.go

@ -12,7 +12,7 @@ import (
filter "github.com/ipfs/go-ipfs/p2p/net/filter"
addrutil "github.com/ipfs/go-ipfs/p2p/net/swarm/addr"
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"
ma "github.com/ipfs/go-ipfs/Godeps/_workspace/src/github.com/jbenet/go-multiaddr"
ps "github.com/ipfs/go-ipfs/Godeps/_workspace/src/github.com/jbenet/go-peerstream"
@ -25,7 +25,7 @@ import (
context "github.com/ipfs/go-ipfs/Godeps/_workspace/src/golang.org/x/net/context"
)
var log = eventlog.Logger("swarm2")
var log = logging.Logger("swarm2")
var PSTransport pst.Transport

3
peer/peer.go

@ -13,9 +13,10 @@ import (
ic "github.com/ipfs/go-ipfs/p2p/crypto"
u "github.com/ipfs/go-ipfs/util"
logging "github.com/ipfs/go-ipfs/vendor/go-log-v1.0.0"
)
var log = u.Logger("peer")
var log = logging.Logger("peer")
// ID represents the identity of a peer.
type ID string

4
peer/queue/sync.go

@ -3,10 +3,10 @@ package queue
import (
context "github.com/ipfs/go-ipfs/Godeps/_workspace/src/golang.org/x/net/context"
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("peerqueue")
var log = logging.Logger("peerqueue")
// ChanQueue makes any PeerQueue synchronizable through channels.
type ChanQueue struct {

4
protocol/identify/id.go

@ -16,11 +16,11 @@ import (
protocol "github.com/ipfs/go-ipfs/p2p/protocol"
pb "github.com/ipfs/go-ipfs/p2p/protocol/identify/pb"
config "github.com/ipfs/go-ipfs/repo/config"
eventlog "github.com/ipfs/go-ipfs/thirdparty/eventlog"
logging "github.com/ipfs/go-ipfs/vendor/go-log-v1.0.0"
lgbl "github.com/ipfs/go-ipfs/util/eventlog/loggables"
)
var log = eventlog.Logger("net/identify")
var log = logging.Logger("net/identify")
// ID is the protocol.ID of the Identify Service.
const ID protocol.ID = "/ipfs/identify"

4
protocol/mux.go

@ -7,11 +7,11 @@ import (
context "github.com/ipfs/go-ipfs/Godeps/_workspace/src/golang.org/x/net/context"
inet "github.com/ipfs/go-ipfs/p2p/net"
eventlog "github.com/ipfs/go-ipfs/thirdparty/eventlog"
logging "github.com/ipfs/go-ipfs/vendor/go-log-v1.0.0"
lgbl "github.com/ipfs/go-ipfs/util/eventlog/loggables"
)
var log = eventlog.Logger("net/mux")
var log = logging.Logger("net/mux")
type streamHandlerMap map[ID]inet.StreamHandler

4
protocol/ping/ping.go

@ -11,11 +11,11 @@ import (
host "github.com/ipfs/go-ipfs/p2p/host"
inet "github.com/ipfs/go-ipfs/p2p/net"
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"
u "github.com/ipfs/go-ipfs/util"
)
var log = eventlog.Logger("ping")
var log = logging.Logger("ping")
const PingSize = 32

4
protocol/relay/relay.go

@ -10,10 +10,10 @@ import (
inet "github.com/ipfs/go-ipfs/p2p/net"
peer "github.com/ipfs/go-ipfs/p2p/peer"
protocol "github.com/ipfs/go-ipfs/p2p/protocol"
eventlog "github.com/ipfs/go-ipfs/thirdparty/eventlog"
logging "github.com/ipfs/go-ipfs/vendor/go-log-v1.0.0"
)
var log = eventlog.Logger("p2p/protocol/relay")
var log = logging.Logger("p2p/protocol/relay")
// ID is the protocol.ID of the Relay Service.
const ID protocol.ID = "/ipfs/relay"

4
protocol/relay/relay_test.go

@ -8,12 +8,12 @@ import (
protocol "github.com/ipfs/go-ipfs/p2p/protocol"
relay "github.com/ipfs/go-ipfs/p2p/protocol/relay"
testutil "github.com/ipfs/go-ipfs/p2p/test/util"
eventlog "github.com/ipfs/go-ipfs/thirdparty/eventlog"
logging "github.com/ipfs/go-ipfs/vendor/go-log-v1.0.0"
context "github.com/ipfs/go-ipfs/Godeps/_workspace/src/golang.org/x/net/context"
)
var log = eventlog.Logger("relay_test")
var log = logging.Logger("relay_test")
func TestRelaySimple(t *testing.T) {

4
test/backpressure/backpressure_test.go

@ -11,13 +11,13 @@ import (
peer "github.com/ipfs/go-ipfs/p2p/peer"
protocol "github.com/ipfs/go-ipfs/p2p/protocol"
testutil "github.com/ipfs/go-ipfs/p2p/test/util"
eventlog "github.com/ipfs/go-ipfs/thirdparty/eventlog"
logging "github.com/ipfs/go-ipfs/vendor/go-log-v1.0.0"
context "github.com/ipfs/go-ipfs/Godeps/_workspace/src/golang.org/x/net/context"
u "github.com/ipfs/go-ipfs/util"
)
var log = eventlog.Logger("backpressure")
var log = logging.Logger("backpressure")
// TestBackpressureStreamHandler tests whether mux handler
// ratelimiting works. Meaning, since the handler is sequential

4
test/reconnects/reconnect_test.go

@ -12,7 +12,7 @@ import (
swarm "github.com/ipfs/go-ipfs/p2p/net/swarm"
protocol "github.com/ipfs/go-ipfs/p2p/protocol"
testutil "github.com/ipfs/go-ipfs/p2p/test/util"
eventlog "github.com/ipfs/go-ipfs/thirdparty/eventlog"
logging "github.com/ipfs/go-ipfs/vendor/go-log-v1.0.0"
u "github.com/ipfs/go-ipfs/util"
ps "github.com/ipfs/go-ipfs/Godeps/_workspace/src/github.com/jbenet/go-peerstream"
@ -24,7 +24,7 @@ func init() {
ps.GarbageCollectTimeout = 10 * time.Millisecond
}
var log = eventlog.Logger("reconnect")
var log = logging.Logger("reconnect")
func EchoStreamHandler(stream inet.Stream) {
c := stream.Conn()

4
test/util/key.go

@ -5,7 +5,7 @@ import (
"io"
"testing"
eventlog "github.com/ipfs/go-ipfs/thirdparty/eventlog"
logging "github.com/ipfs/go-ipfs/vendor/go-log-v1.0.0"
u "github.com/ipfs/go-ipfs/util"
testutil "github.com/ipfs/go-ipfs/util/testutil"
@ -15,7 +15,7 @@ import (
ma "github.com/ipfs/go-ipfs/Godeps/_workspace/src/github.com/jbenet/go-multiaddr"
)
var log = eventlog.Logger("boguskey")
var log = logging.Logger("boguskey")
// TestBogusPrivateKey is a key used for testing (to avoid expensive keygen)
type TestBogusPrivateKey []byte

Loading…
Cancel
Save