Commit 8dce0076 authored by Matt Joiner's avatar Matt Joiner
Browse files

Upgrade to log v0.5.0

parent 2c9c45f3
...@@ -31,7 +31,7 @@ func mainErr() int { ...@@ -31,7 +31,7 @@ func mainErr() int {
s, err := dht.NewServer(func() *dht.ServerConfig { s, err := dht.NewServer(func() *dht.ServerConfig {
sc := dht.NewDefaultServerConfig() sc := dht.NewDefaultServerConfig()
if flags.Debug { if flags.Debug {
sc.Logger = log.Default sc.Logger = log.Default()
} }
return sc return sc
}()) }())
......
...@@ -103,14 +103,14 @@ func TestPing(t *testing.T) { ...@@ -103,14 +103,14 @@ func TestPing(t *testing.T) {
srv, err := NewServer(&ServerConfig{ srv, err := NewServer(&ServerConfig{
Conn: recvConn, Conn: recvConn,
NoSecurity: true, NoSecurity: true,
Logger: log.Default, Logger: log.Default(),
}) })
require.NoError(t, err) require.NoError(t, err)
defer srv.Close() defer srv.Close()
srv0, err := NewServer(&ServerConfig{ srv0, err := NewServer(&ServerConfig{
Conn: mustListen("127.0.0.1:5681"), Conn: mustListen("127.0.0.1:5681"),
StartingNodes: addrResolver("127.0.0.1:5680"), StartingNodes: addrResolver("127.0.0.1:5680"),
Logger: log.Default, Logger: log.Default(),
}) })
require.NoError(t, err) require.NoError(t, err)
defer srv0.Close() defer srv0.Close()
...@@ -279,7 +279,7 @@ func TestBootstrapRace(t *testing.T) { ...@@ -279,7 +279,7 @@ func TestBootstrapRace(t *testing.T) {
Conn: &serverPc, Conn: &serverPc,
StartingNodes: addrResolver(remotePc.LocalAddr().String()), StartingNodes: addrResolver(remotePc.LocalAddr().String()),
QueryResendDelay: func() time.Duration { return 0 }, QueryResendDelay: func() time.Duration { return 0 },
Logger: log.Default, Logger: log.Default(),
}) })
require.NoError(t, err) require.NoError(t, err)
defer s.Close() defer s.Close()
......
...@@ -2,7 +2,7 @@ module github.com/anacrolix/dht/v2 ...@@ -2,7 +2,7 @@ module github.com/anacrolix/dht/v2
require ( require (
github.com/anacrolix/envpprof v1.0.1 github.com/anacrolix/envpprof v1.0.1
github.com/anacrolix/log v0.4.0 github.com/anacrolix/log v0.5.0
github.com/anacrolix/missinggo v1.2.1 github.com/anacrolix/missinggo v1.2.1
github.com/anacrolix/missinggo/v2 v2.3.0 github.com/anacrolix/missinggo/v2 v2.3.0
github.com/anacrolix/stm v0.1.1-0.20191106051447-e749ba3531cf github.com/anacrolix/stm v0.1.1-0.20191106051447-e749ba3531cf
......
...@@ -33,8 +33,8 @@ github.com/anacrolix/log v0.3.0/go.mod h1:lWvLTqzAnCWPJA08T2HCstZi0L1y2Wyvm3FJgw ...@@ -33,8 +33,8 @@ github.com/anacrolix/log v0.3.0/go.mod h1:lWvLTqzAnCWPJA08T2HCstZi0L1y2Wyvm3FJgw
github.com/anacrolix/log v0.3.1-0.20190913000754-831e4ffe0174 h1:WyUeGo3Yr2EnzVfzo+JBlfeJoys1Xl7p7bTp3RA2Jvo= github.com/anacrolix/log v0.3.1-0.20190913000754-831e4ffe0174 h1:WyUeGo3Yr2EnzVfzo+JBlfeJoys1Xl7p7bTp3RA2Jvo=
github.com/anacrolix/log v0.3.1-0.20190913000754-831e4ffe0174/go.mod h1:lWvLTqzAnCWPJA08T2HCstZi0L1y2Wyvm3FJgwU9jwU= github.com/anacrolix/log v0.3.1-0.20190913000754-831e4ffe0174/go.mod h1:lWvLTqzAnCWPJA08T2HCstZi0L1y2Wyvm3FJgwU9jwU=
github.com/anacrolix/log v0.3.1-0.20191001111012-13cede988bcd/go.mod h1:lWvLTqzAnCWPJA08T2HCstZi0L1y2Wyvm3FJgwU9jwU= github.com/anacrolix/log v0.3.1-0.20191001111012-13cede988bcd/go.mod h1:lWvLTqzAnCWPJA08T2HCstZi0L1y2Wyvm3FJgwU9jwU=
github.com/anacrolix/log v0.4.0 h1:sOT4yO5Q5+eVONFxKsVCLisyLSOXb+si+tYmFEMCy88= github.com/anacrolix/log v0.5.0 h1:SD3p5SJZ77we9rt+YbRsL64SAQTAns+9nSYXxFmVVi8=
github.com/anacrolix/log v0.4.0/go.mod h1:lWvLTqzAnCWPJA08T2HCstZi0L1y2Wyvm3FJgwU9jwU= github.com/anacrolix/log v0.5.0/go.mod h1:lWvLTqzAnCWPJA08T2HCstZi0L1y2Wyvm3FJgwU9jwU=
github.com/anacrolix/missinggo v0.0.0-20180522035225-b4a5853e62ff/go.mod h1:b0p+7cn+rWMIphK1gDH2hrDuwGOcbB6V4VXeSsEfHVk= github.com/anacrolix/missinggo v0.0.0-20180522035225-b4a5853e62ff/go.mod h1:b0p+7cn+rWMIphK1gDH2hrDuwGOcbB6V4VXeSsEfHVk=
github.com/anacrolix/missinggo v0.0.0-20180725070939-60ef2fbf63df/go.mod h1:kwGiTUTZ0+p4vAz3VbAI5a30t2YbvemcmspjKwrAz5s= github.com/anacrolix/missinggo v0.0.0-20180725070939-60ef2fbf63df/go.mod h1:kwGiTUTZ0+p4vAz3VbAI5a30t2YbvemcmspjKwrAz5s=
github.com/anacrolix/missinggo v0.2.1-0.20190310234110-9fbdc9f242a8 h1:E2Xb2SBsVzHJ1tNMW9QcckYEQcyBKz1ee8qVjeVRWys= github.com/anacrolix/missinggo v0.2.1-0.20190310234110-9fbdc9f242a8 h1:E2Xb2SBsVzHJ1tNMW9QcckYEQcyBKz1ee8qVjeVRWys=
......
...@@ -158,7 +158,7 @@ func NewServer(c *ServerConfig) (s *Server, err error) { ...@@ -158,7 +158,7 @@ func NewServer(c *ServerConfig) (s *Server, err error) {
// If Logger is empty, emulate the old behaviour: Everything is logged to the default location, // If Logger is empty, emulate the old behaviour: Everything is logged to the default location,
// and there are no debug messages. // and there are no debug messages.
if c.Logger.LoggerImpl == nil { if c.Logger.LoggerImpl == nil {
c.Logger = log.Default.WithFilter(func(m log.Msg) bool { c.Logger = log.Default().WithFilter(func(m log.Msg) bool {
return !m.HasValue(log.Debug) return !m.HasValue(log.Debug)
}) })
} }
......
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