Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
Menu
Open sidebar
adam.huang
go-libp2p
Commits
983ed327
Commit
983ed327
authored
Sep 14, 2015
by
Jeromy
Browse files
extract logging
License: MIT Signed-off-by:
Jeromy
<
jeromyj@gmail.com
>
parent
5d1b8295
Changes
21
Show whitespace changes
Inline
Side-by-side
crypto/key.go
View file @
983ed327
...
...
@@ -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"
)
...
...
crypto/secio/protocol.go
View file @
983ed327
...
...
@@ -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
=
eventlo
g
.
Logger
(
"secio"
)
var
log
=
loggin
g
.
Logger
(
"secio"
)
// ErrUnsupportedKeyType is returned when a private key cast/type switch fails.
var
ErrUnsupportedKeyType
=
errors
.
New
(
"unsupported key type"
)
...
...
discovery/mdns.go
View file @
983ed327
...
...
@@ -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"
...
...
host/basic/basic_host.go
View file @
983ed327
...
...
@@ -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"
eventlo
g
"github.com/ipfs/go-ipfs/
thirdparty/eventlog
"
loggin
g
"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
=
eventlo
g
.
Logger
(
"p2p/host/basic"
)
var
log
=
loggin
g
.
Logger
(
"p2p/host/basic"
)
// Option is a type used to pass in options to the host.
type
Option
int
...
...
host/host.go
View file @
983ed327
...
...
@@ -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"
eventlo
g
"github.com/ipfs/go-ipfs/
thirdparty/eventlog
"
loggin
g
"github.com/ipfs/go-ipfs/
vendor/go-log-v1.0.0
"
)
var
log
=
eventlo
g
.
Logger
(
"p2p/host"
)
var
log
=
loggin
g
.
Logger
(
"p2p/host"
)
// Host is an object participating in a p2p network, which
// implements protocols or provides services. It handles
...
...
host/routed/routed.go
View file @
983ed327
...
...
@@ -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"
eventlo
g
"github.com/ipfs/go-ipfs/
thirdparty/eventlog
"
loggin
g
"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
=
eventlo
g
.
Logger
(
"p2p/host/routed"
)
var
log
=
loggin
g
.
Logger
(
"p2p/host/routed"
)
// AddressTTL is the expiry time for our addresses.
// We expire them quickly.
...
...
nat/nat.go
View file @
983ed327
...
...
@@ -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
=
eventlo
g
.
Logger
(
"nat"
)
var
log
=
loggin
g
.
Logger
(
"nat"
)
// MappingDuration is a default port mapping duration.
// Port mappings are renewed every (MappingDuration / 3)
...
...
net/conn/conn.go
View file @
983ed327
...
...
@@ -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"
eventlo
g
"github.com/ipfs/go-ipfs/
thirdparty/eventlog
"
loggin
g
"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
=
eventlo
g
.
Logger
(
"conn"
)
var
log
=
loggin
g
.
Logger
(
"conn"
)
// ReleaseBuffer puts the given byte array back into the buffer pool,
// first verifying that it is the correct size
...
...
net/mock/mock.go
View file @
983ed327
package
mocknet
import
(
eventlo
g
"github.com/ipfs/go-ipfs/
thirdparty/eventlog
"
loggin
g
"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
=
eventlo
g
.
Logger
(
"mocknet"
)
var
log
=
loggin
g
.
Logger
(
"mocknet"
)
// WithNPeers constructs a Mocknet with N peers.
func
WithNPeers
(
ctx
context
.
Context
,
n
int
)
(
Mocknet
,
error
)
{
...
...
net/swarm/addr/addr.go
View file @
983ed327
...
...
@@ -3,14 +3,14 @@ package addrutil
import
(
"fmt"
eventlo
g
"github.com/ipfs/go-ipfs/
thirdparty/eventlog
"
loggin
g
"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
=
eventlo
g
.
Logger
(
"p2p/net/swarm/addr"
)
var
log
=
loggin
g
.
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
()
eventlo
g
.
Loggable
{
log
.
Event
(
context
.
TODO
(),
"interfaceListenAddresses"
,
func
()
loggin
g
.
Loggable
{
var
addrs
[]
string
for
_
,
addr
:=
range
outputAddrs
{
addrs
=
append
(
addrs
,
addr
.
String
())
}
return
eventlo
g
.
Metadata
{
"addresses"
:
addrs
}
return
loggin
g
.
Metadata
{
"addresses"
:
addrs
}
}())
log
.
Debug
(
"ResolveUnspecifiedAddresses:"
,
unspecAddrs
,
ifaceAddrs
,
outputAddrs
)
...
...
net/swarm/swarm.go
View file @
983ed327
...
...
@@ -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"
eventlo
g
"github.com/ipfs/go-ipfs/
thirdparty/eventlog
"
loggin
g
"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
=
eventlo
g
.
Logger
(
"swarm2"
)
var
log
=
loggin
g
.
Logger
(
"swarm2"
)
var
PSTransport
pst
.
Transport
...
...
peer/peer.go
View file @
983ed327
...
...
@@ -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
...
...
peer/queue/sync.go
View file @
983ed327
...
...
@@ -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"
eventlo
g
"github.com/ipfs/go-ipfs/
thirdparty/eventlog
"
loggin
g
"github.com/ipfs/go-ipfs/
vendor/go-log-v1.0.0
"
)
var
log
=
eventlo
g
.
Logger
(
"peerqueue"
)
var
log
=
loggin
g
.
Logger
(
"peerqueue"
)
// ChanQueue makes any PeerQueue synchronizable through channels.
type
ChanQueue
struct
{
...
...
protocol/identify/id.go
View file @
983ed327
...
...
@@ -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"
eventlo
g
"github.com/ipfs/go-ipfs/
thirdparty/eventlog
"
loggin
g
"github.com/ipfs/go-ipfs/
vendor/go-log-v1.0.0
"
lgbl
"github.com/ipfs/go-ipfs/util/eventlog/loggables"
)
var
log
=
eventlo
g
.
Logger
(
"net/identify"
)
var
log
=
loggin
g
.
Logger
(
"net/identify"
)
// ID is the protocol.ID of the Identify Service.
const
ID
protocol
.
ID
=
"/ipfs/identify"
...
...
protocol/mux.go
View file @
983ed327
...
...
@@ -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"
eventlo
g
"github.com/ipfs/go-ipfs/
thirdparty/eventlog
"
loggin
g
"github.com/ipfs/go-ipfs/
vendor/go-log-v1.0.0
"
lgbl
"github.com/ipfs/go-ipfs/util/eventlog/loggables"
)
var
log
=
eventlo
g
.
Logger
(
"net/mux"
)
var
log
=
loggin
g
.
Logger
(
"net/mux"
)
type
streamHandlerMap
map
[
ID
]
inet
.
StreamHandler
...
...
protocol/ping/ping.go
View file @
983ed327
...
...
@@ -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"
eventlo
g
"github.com/ipfs/go-ipfs/
thirdparty/eventlog
"
loggin
g
"github.com/ipfs/go-ipfs/
vendor/go-log-v1.0.0
"
u
"github.com/ipfs/go-ipfs/util"
)
var
log
=
eventlo
g
.
Logger
(
"ping"
)
var
log
=
loggin
g
.
Logger
(
"ping"
)
const
PingSize
=
32
...
...
protocol/relay/relay.go
View file @
983ed327
...
...
@@ -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"
eventlo
g
"github.com/ipfs/go-ipfs/
thirdparty/eventlog
"
loggin
g
"github.com/ipfs/go-ipfs/
vendor/go-log-v1.0.0
"
)
var
log
=
eventlo
g
.
Logger
(
"p2p/protocol/relay"
)
var
log
=
loggin
g
.
Logger
(
"p2p/protocol/relay"
)
// ID is the protocol.ID of the Relay Service.
const
ID
protocol
.
ID
=
"/ipfs/relay"
...
...
protocol/relay/relay_test.go
View file @
983ed327
...
...
@@ -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"
eventlo
g
"github.com/ipfs/go-ipfs/
thirdparty/eventlog
"
loggin
g
"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
=
eventlo
g
.
Logger
(
"relay_test"
)
var
log
=
loggin
g
.
Logger
(
"relay_test"
)
func
TestRelaySimple
(
t
*
testing
.
T
)
{
...
...
test/backpressure/backpressure_test.go
View file @
983ed327
...
...
@@ -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"
eventlo
g
"github.com/ipfs/go-ipfs/
thirdparty/eventlog
"
loggin
g
"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
=
eventlo
g
.
Logger
(
"backpressure"
)
var
log
=
loggin
g
.
Logger
(
"backpressure"
)
// TestBackpressureStreamHandler tests whether mux handler
// ratelimiting works. Meaning, since the handler is sequential
...
...
test/reconnects/reconnect_test.go
View file @
983ed327
...
...
@@ -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"
eventlo
g
"github.com/ipfs/go-ipfs/
thirdparty/eventlog
"
loggin
g
"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
=
eventlo
g
.
Logger
(
"reconnect"
)
var
log
=
loggin
g
.
Logger
(
"reconnect"
)
func
EchoStreamHandler
(
stream
inet
.
Stream
)
{
c
:=
stream
.
Conn
()
...
...
Prev
1
2
Next
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