Commit 983ed327 authored by Jeromy's avatar Jeromy
Browse files

extract logging



License: MIT
Signed-off-by: default avatarJeromy <jeromyj@gmail.com>
parent 5d1b8295
...@@ -23,9 +23,10 @@ import ( ...@@ -23,9 +23,10 @@ import (
pb "github.com/ipfs/go-ipfs/p2p/crypto/pb" pb "github.com/ipfs/go-ipfs/p2p/crypto/pb"
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"
) )
var log = u.Logger("crypto") var log = logging.Logger("crypto")
var ErrBadKeyType = errors.New("invalid or unsupported key type") var ErrBadKeyType = errors.New("invalid or unsupported key type")
......
...@@ -14,11 +14,11 @@ import ( ...@@ -14,11 +14,11 @@ import (
ci "github.com/ipfs/go-ipfs/p2p/crypto" ci "github.com/ipfs/go-ipfs/p2p/crypto"
pb "github.com/ipfs/go-ipfs/p2p/crypto/secio/pb" pb "github.com/ipfs/go-ipfs/p2p/crypto/secio/pb"
peer "github.com/ipfs/go-ipfs/p2p/peer" peer "github.com/ipfs/go-ipfs/p2p/peer"
eventlog "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"
) )
var log = eventlog.Logger("secio") var log = logging.Logger("secio")
// ErrUnsupportedKeyType is returned when a private key cast/type switch fails. // ErrUnsupportedKeyType is returned when a private key cast/type switch fails.
var ErrUnsupportedKeyType = errors.New("unsupported key type") var ErrUnsupportedKeyType = errors.New("unsupported key type")
......
...@@ -15,10 +15,10 @@ import ( ...@@ -15,10 +15,10 @@ import (
"github.com/ipfs/go-ipfs/p2p/host" "github.com/ipfs/go-ipfs/p2p/host"
"github.com/ipfs/go-ipfs/p2p/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("mdns") var log = logging.Logger("mdns")
const ServiceTag = "discovery.ipfs.io" const ServiceTag = "discovery.ipfs.io"
......
...@@ -8,7 +8,7 @@ import ( ...@@ -8,7 +8,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"
metrics "github.com/ipfs/go-ipfs/metrics" metrics "github.com/ipfs/go-ipfs/metrics"
mstream "github.com/ipfs/go-ipfs/metrics/stream" 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" inet "github.com/ipfs/go-ipfs/p2p/net"
peer "github.com/ipfs/go-ipfs/p2p/peer" peer "github.com/ipfs/go-ipfs/p2p/peer"
...@@ -17,7 +17,7 @@ import ( ...@@ -17,7 +17,7 @@ import (
relay "github.com/ipfs/go-ipfs/p2p/protocol/relay" 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. // Option is a type used to pass in options to the host.
type Option int type Option int
......
...@@ -7,10 +7,10 @@ import ( ...@@ -7,10 +7,10 @@ import (
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"
protocol "github.com/ipfs/go-ipfs/p2p/protocol" 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 // Host is an object participating in a p2p network, which
// implements protocols or provides services. It handles // implements protocols or provides services. It handles
......
...@@ -6,7 +6,7 @@ import ( ...@@ -6,7 +6,7 @@ import (
ma "github.com/ipfs/go-ipfs/Godeps/_workspace/src/github.com/jbenet/go-multiaddr" 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" 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" lgbl "github.com/ipfs/go-ipfs/util/eventlog/loggables"
metrics "github.com/ipfs/go-ipfs/metrics" metrics "github.com/ipfs/go-ipfs/metrics"
...@@ -17,7 +17,7 @@ import ( ...@@ -17,7 +17,7 @@ import (
routing "github.com/ipfs/go-ipfs/routing" 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. // AddressTTL is the expiry time for our addresses.
// We expire them quickly. // We expire them quickly.
......
...@@ -14,8 +14,8 @@ import ( ...@@ -14,8 +14,8 @@ import (
nat "github.com/ipfs/go-ipfs/Godeps/_workspace/src/github.com/fd/go-nat" 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" 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" 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" notifier "github.com/ipfs/go-ipfs/thirdparty/notifier"
logging "github.com/ipfs/go-ipfs/vendor/go-log-v1.0.0"
) )
var ( var (
...@@ -23,7 +23,7 @@ var ( ...@@ -23,7 +23,7 @@ var (
ErrNoMapping = errors.New("mapping not established") ErrNoMapping = errors.New("mapping not established")
) )
var log = eventlog.Logger("nat") var log = logging.Logger("nat")
// MappingDuration is a default port mapping duration. // MappingDuration is a default port mapping duration.
// Port mappings are renewed every (MappingDuration / 3) // Port mappings are renewed every (MappingDuration / 3)
......
...@@ -13,12 +13,12 @@ import ( ...@@ -13,12 +13,12 @@ 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"
ic "github.com/ipfs/go-ipfs/p2p/crypto" ic "github.com/ipfs/go-ipfs/p2p/crypto"
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"
u "github.com/ipfs/go-ipfs/util" u "github.com/ipfs/go-ipfs/util"
lgbl "github.com/ipfs/go-ipfs/util/eventlog/loggables" 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, // ReleaseBuffer puts the given byte array back into the buffer pool,
// first verifying that it is the correct size // first verifying that it is the correct size
......
package mocknet package mocknet
import ( 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" 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. // WithNPeers constructs a Mocknet with N peers.
func WithNPeers(ctx context.Context, n int) (Mocknet, error) { func WithNPeers(ctx context.Context, n int) (Mocknet, error) {
......
...@@ -3,14 +3,14 @@ package addrutil ...@@ -3,14 +3,14 @@ package addrutil
import ( import (
"fmt" "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" 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" 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" 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. // SupportedTransportStrings is the list of supported transports for the swarm.
// These are strings of encapsulated multiaddr protocols. E.g.: // These are strings of encapsulated multiaddr protocols. E.g.:
...@@ -176,12 +176,12 @@ func ResolveUnspecifiedAddresses(unspecAddrs, ifaceAddrs []ma.Multiaddr) ([]ma.M ...@@ -176,12 +176,12 @@ func ResolveUnspecifiedAddresses(unspecAddrs, ifaceAddrs []ma.Multiaddr) ([]ma.M
return nil, fmt.Errorf("failed to specify addrs: %s", unspecAddrs) 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 var addrs []string
for _, addr := range outputAddrs { for _, addr := range outputAddrs {
addrs = append(addrs, addr.String()) addrs = append(addrs, addr.String())
} }
return eventlog.Metadata{"addresses": addrs} return logging.Metadata{"addresses": addrs}
}()) }())
log.Debug("ResolveUnspecifiedAddresses:", unspecAddrs, ifaceAddrs, outputAddrs) log.Debug("ResolveUnspecifiedAddresses:", unspecAddrs, ifaceAddrs, outputAddrs)
......
...@@ -12,7 +12,7 @@ import ( ...@@ -12,7 +12,7 @@ import (
filter "github.com/ipfs/go-ipfs/p2p/net/filter" filter "github.com/ipfs/go-ipfs/p2p/net/filter"
addrutil "github.com/ipfs/go-ipfs/p2p/net/swarm/addr" addrutil "github.com/ipfs/go-ipfs/p2p/net/swarm/addr"
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"
ma "github.com/ipfs/go-ipfs/Godeps/_workspace/src/github.com/jbenet/go-multiaddr" 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" ps "github.com/ipfs/go-ipfs/Godeps/_workspace/src/github.com/jbenet/go-peerstream"
...@@ -25,7 +25,7 @@ import ( ...@@ -25,7 +25,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("swarm2") var log = logging.Logger("swarm2")
var PSTransport pst.Transport var PSTransport pst.Transport
......
...@@ -13,9 +13,10 @@ import ( ...@@ -13,9 +13,10 @@ import (
ic "github.com/ipfs/go-ipfs/p2p/crypto" ic "github.com/ipfs/go-ipfs/p2p/crypto"
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"
) )
var log = u.Logger("peer") var log = logging.Logger("peer")
// ID represents the identity of a peer. // ID represents the identity of a peer.
type ID string type ID string
......
...@@ -3,10 +3,10 @@ package queue ...@@ -3,10 +3,10 @@ package queue
import ( 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"
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("peerqueue") var log = logging.Logger("peerqueue")
// ChanQueue makes any PeerQueue synchronizable through channels. // ChanQueue makes any PeerQueue synchronizable through channels.
type ChanQueue struct { type ChanQueue struct {
......
...@@ -16,11 +16,11 @@ import ( ...@@ -16,11 +16,11 @@ import (
protocol "github.com/ipfs/go-ipfs/p2p/protocol" protocol "github.com/ipfs/go-ipfs/p2p/protocol"
pb "github.com/ipfs/go-ipfs/p2p/protocol/identify/pb" pb "github.com/ipfs/go-ipfs/p2p/protocol/identify/pb"
config "github.com/ipfs/go-ipfs/repo/config" 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" 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. // ID is the protocol.ID of the Identify Service.
const ID protocol.ID = "/ipfs/identify" const ID protocol.ID = "/ipfs/identify"
......
...@@ -7,11 +7,11 @@ import ( ...@@ -7,11 +7,11 @@ 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"
inet "github.com/ipfs/go-ipfs/p2p/net" 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" 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 type streamHandlerMap map[ID]inet.StreamHandler
......
...@@ -11,11 +11,11 @@ import ( ...@@ -11,11 +11,11 @@ import (
host "github.com/ipfs/go-ipfs/p2p/host" host "github.com/ipfs/go-ipfs/p2p/host"
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"
u "github.com/ipfs/go-ipfs/util" u "github.com/ipfs/go-ipfs/util"
) )
var log = eventlog.Logger("ping") var log = logging.Logger("ping")
const PingSize = 32 const PingSize = 32
......
...@@ -10,10 +10,10 @@ import ( ...@@ -10,10 +10,10 @@ import (
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"
protocol "github.com/ipfs/go-ipfs/p2p/protocol" 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. // ID is the protocol.ID of the Relay Service.
const ID protocol.ID = "/ipfs/relay" const ID protocol.ID = "/ipfs/relay"
......
...@@ -8,12 +8,12 @@ import ( ...@@ -8,12 +8,12 @@ import (
protocol "github.com/ipfs/go-ipfs/p2p/protocol" protocol "github.com/ipfs/go-ipfs/p2p/protocol"
relay "github.com/ipfs/go-ipfs/p2p/protocol/relay" relay "github.com/ipfs/go-ipfs/p2p/protocol/relay"
testutil "github.com/ipfs/go-ipfs/p2p/test/util" 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" 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) { func TestRelaySimple(t *testing.T) {
......
...@@ -11,13 +11,13 @@ import ( ...@@ -11,13 +11,13 @@ import (
peer "github.com/ipfs/go-ipfs/p2p/peer" peer "github.com/ipfs/go-ipfs/p2p/peer"
protocol "github.com/ipfs/go-ipfs/p2p/protocol" protocol "github.com/ipfs/go-ipfs/p2p/protocol"
testutil "github.com/ipfs/go-ipfs/p2p/test/util" 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" context "github.com/ipfs/go-ipfs/Godeps/_workspace/src/golang.org/x/net/context"
u "github.com/ipfs/go-ipfs/util" u "github.com/ipfs/go-ipfs/util"
) )
var log = eventlog.Logger("backpressure") var log = logging.Logger("backpressure")
// TestBackpressureStreamHandler tests whether mux handler // TestBackpressureStreamHandler tests whether mux handler
// ratelimiting works. Meaning, since the handler is sequential // ratelimiting works. Meaning, since the handler is sequential
......
...@@ -12,7 +12,7 @@ import ( ...@@ -12,7 +12,7 @@ import (
swarm "github.com/ipfs/go-ipfs/p2p/net/swarm" swarm "github.com/ipfs/go-ipfs/p2p/net/swarm"
protocol "github.com/ipfs/go-ipfs/p2p/protocol" protocol "github.com/ipfs/go-ipfs/p2p/protocol"
testutil "github.com/ipfs/go-ipfs/p2p/test/util" 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" u "github.com/ipfs/go-ipfs/util"
ps "github.com/ipfs/go-ipfs/Godeps/_workspace/src/github.com/jbenet/go-peerstream" ps "github.com/ipfs/go-ipfs/Godeps/_workspace/src/github.com/jbenet/go-peerstream"
...@@ -24,7 +24,7 @@ func init() { ...@@ -24,7 +24,7 @@ func init() {
ps.GarbageCollectTimeout = 10 * time.Millisecond ps.GarbageCollectTimeout = 10 * time.Millisecond
} }
var log = eventlog.Logger("reconnect") var log = logging.Logger("reconnect")
func EchoStreamHandler(stream inet.Stream) { func EchoStreamHandler(stream inet.Stream) {
c := stream.Conn() c := stream.Conn()
......
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