fix: migrate from deprecated warning function
Steven Allen committed
Jan 16, 2020 at 15:48 UTC
a53d48059bff98e3a48faf79103651ce301a7ab2
20 files changed
+25
-25
cmd/ipfs/daemon.go
+1
-1
@@ -227,7 +227,7 @@ func daemonFunc(req *cmds.Request, re cmds.ResponseEmitter, env cmds.Environment
227
// check transport encryption flag.
228
unencrypted, _ := req.Options[unencryptTransportKwd].(bool)
229
if unencrypted {
230
- log.Warningf(`Running with --%s: All connections are UNENCRYPTED.
230
+ log.Warnf(`Running with --%s: All connections are UNENCRYPTED.
231
You will not be able to connect to regular encrypted networks.`, unencryptTransportKwd)
232
}
233
core/bootstrap/bootstrap.go
+1
-1
@@ -80,7 +80,7 @@ func Bootstrap(id peer.ID, host host.Host, rt routing.Routing, cfg BootstrapConf
80
if len(cfg.BootstrapPeers()) == 0 {
81
// We *need* to bootstrap but we have no bootstrap peers
82
// configured *at all*, inform the user.
83
- log.Warning("no bootstrap nodes configured: go-ipfs may have difficulty connecting to the network")
83
+ log.Warn("no bootstrap nodes configured: go-ipfs may have difficulty connecting to the network")
84
}
85
86
// the periodic bootstrap function -- the connection supervisor
core/commands/add.go
+1
-1
@@ -286,7 +286,7 @@ You can now check what blocks have been created by:
286
go func() {
287
size, err := req.Files.Size()
288
if err != nil {
289
- log.Warningf("error getting files size: %s", err)
289
+ log.Warnf("error getting files size: %s", err)
290
// see comment above
291
return
292
}
core/commands/cat.go
+1
-1
@@ -104,7 +104,7 @@ var CatCmd = &cmds.Command{
104
return err
105
}
106
default:
107
- log.Warningf("cat postrun: received unexpected type %T", val)
107
+ log.Warnf("cat postrun: received unexpected type %T", val)
108
}
109
}
110
},
core/core.go
+1
-1
@@ -143,7 +143,7 @@ func (n *IpfsNode) Bootstrap(cfg bootstrap.BootstrapConfig) error {
143
cfg.BootstrapPeers = func() []peer.AddrInfo {
144
ps, err := n.loadBootstrapPeers()
145
if err != nil {
146
- log.Warning("failed to parse bootstrap peers from config")
146
+ log.Warn("failed to parse bootstrap peers from config")
147
return nil
148
}
149
return ps
core/corehttp/commands.go
+1
-1
@@ -47,7 +47,7 @@ var defaultLocalhostOrigins = []string{
47
func addCORSFromEnv(c *cmdsHttp.ServerConfig) {
48
origin := os.Getenv(originEnvKey)
49
if origin != "" {
50
- log.Warning(originEnvKeyDeprecate)
50
+ log.Warn(originEnvKeyDeprecate)
51
c.AppendAllowedOrigins(origin)
52
}
53
}
core/corehttp/gateway_handler.go
+1
-1
@@ -610,7 +610,7 @@ func webError(w http.ResponseWriter, message string, err error, defaultCode int)
610
func webErrorWithCode(w http.ResponseWriter, message string, err error, code int) {
611
http.Error(w, fmt.Sprintf("%s: %s", message, err), code)
612
if code >= 500 {
613
- log.Warningf("server error: %s: %s", err)
613
+ log.Warnf("server error: %s: %s", err)
614
}
615
}
616
core/corerepo/gc.go
+1
-1
@@ -212,7 +212,7 @@ func (gc *GC) maybeGC(ctx context.Context, offset uint64) error {
212
213
if storage+offset > gc.StorageGC {
214
if storage+offset > gc.StorageMax {
215
- log.Warningf("pre-GC: %s", ErrMaxStorageExceeded)
215
+ log.Warnf("pre-GC: %s", ErrMaxStorageExceeded)
216
}
217
218
// Do GC here
core/node/libp2p/discovery.go
+1
-1
@@ -24,7 +24,7 @@ func (dh *discoveryHandler) HandlePeerFound(p peer.AddrInfo) {
24
ctx, cancel := context.WithTimeout(dh.ctx, discoveryConnTimeout)
25
defer cancel()
26
if err := dh.host.Connect(ctx, p); err != nil {
27
- log.Warningf("failed to connect to peer %s found by discovery: %s", p.ID, err)
27
+ log.Warnf("failed to connect to peer %s found by discovery: %s", p.ID, err)
28
}
29
}
30
core/node/libp2p/pnet.go
+2
-2
@@ -51,8 +51,8 @@ func PNetChecker(repo repo.Repo, ph host.Host, lc fx.Lifecycle) error {
51
select {
52
case <-t.C:
53
if len(ph.Network().Peers()) == 0 {
54
- log.Warning("We are in private network and have no peers.")
55
- log.Warning("This might be configuration mistake.")
54
+ log.Warn("We are in private network and have no peers.")
55
+ log.Warn("This might be configuration mistake.")
56
}
57
case <-done:
58
return
core/node/libp2p/smux.go
+1
-1
@@ -36,7 +36,7 @@ func makeSmuxTransportOption(mplexExp bool) libp2p.Option {
36
for _, id := range order {
37
tpt, ok := muxers[id]
38
if !ok {
39
- log.Warning("unknown or duplicate muxer in LIBP2P_MUX_PREFS: %s", id)
39
+ log.Warn("unknown or duplicate muxer in LIBP2P_MUX_PREFS: %s", id)
40
continue
41
}
42
delete(muxers, id)
core/node/libp2p/transport.go
+1
-1
@@ -15,7 +15,7 @@ func Security(enabled, preferTLS bool) interface{} {
15
if !enabled {
16
return func() (opts Libp2pOpts) {
17
// TODO: shouldn't this be Errorf to guarantee visibility?
18
- log.Warningf(`Your IPFS node has been configured to run WITHOUT ENCRYPTED CONNECTIONS.
18
+ log.Warnf(`Your IPFS node has been configured to run WITHOUT ENCRYPTED CONNECTIONS.
19
You will not be able to connect to any nodes configured to use encrypted connections`)
20
opts.Opts = append(opts.Opts, libp2p.NoSecurity)
21
return opts
fuse/ipns/ipns_unix.go
+1
-1
@@ -201,7 +201,7 @@ func (s *Root) Lookup(ctx context.Context, name string) (fs.Node, error) {
201
ipnsName := "/ipns/" + name
202
resolved, err := s.Ipfs.Namesys.Resolve(s.Ipfs.Context(), ipnsName)
203
if err != nil {
204
- log.Warningf("ipns: namesys resolve error: %s", err)
204
+ log.Warnf("ipns: namesys resolve error: %s", err)
205
return nil, fuse.ENOENT
206
}
207
fuse/mount/fuse.go
+2
-2
@@ -110,7 +110,7 @@ func (m *mount) unmount() error {
110
m.setActive(false)
111
return nil
112
}
113
- log.Warningf("fuse unmount err: %s", err)
113
+ log.Warnf("fuse unmount err: %s", err)
114
115
// try closing the fuseConn
116
err = m.fuseConn.Close()
@@ -118,7 +118,7 @@ func (m *mount) unmount() error {
118
m.setActive(false)
119
return nil
120
}
121
- log.Warningf("fuse conn error: %s", err)
121
+ log.Warnf("fuse conn error: %s", err)
122
123
// try mount.ForceUnmountManyTimes
124
if err := ForceUnmountManyTimes(m, 10); err != nil {
fuse/mount/mount.go
+2
-2
@@ -36,7 +36,7 @@ type Mount interface {
36
// It does so by calling diskutil or fusermount directly.
37
func ForceUnmount(m Mount) error {
38
point := m.MountPoint()
39
- log.Warningf("Force-Unmounting %s...", point)
39
+ log.Warnf("Force-Unmounting %s...", point)
40
41
cmd, err := UnmountCmd(point)
42
if err != nil {
@@ -98,7 +98,7 @@ type closer struct {
98
}
99
100
func (c *closer) Close() error {
101
- log.Warning(" (c *closer) Close(),", c.M.MountPoint())
101
+ log.Warn(" (c *closer) Close(),", c.M.MountPoint())
102
return c.M.Unmount()
103
}
104
fuse/readonly/readonly_unix.go
+2
-2
@@ -186,7 +186,7 @@ func (s *Node) ReadDirAll(ctx context.Context) ([]fuse.Dirent, error) {
186
}
187
nd, err := s.Ipfs.DAG.Get(ctx, lnk.Cid)
188
if err != nil {
189
- log.Warning("error fetching directory child node: ", err)
189
+ log.Warn("error fetching directory child node: ", err)
190
}
191
192
t := fuse.DT_Unknown
@@ -195,7 +195,7 @@ func (s *Node) ReadDirAll(ctx context.Context) ([]fuse.Dirent, error) {
195
t = fuse.DT_File
196
case *mdag.ProtoNode:
197
if fsn, err := ft.FSNodeFromBytes(nd.Data()); err != nil {
198
- log.Warning("failed to unmarshal protonode data field:", err)
198
+ log.Warn("failed to unmarshal protonode data field:", err)
199
} else {
200
switch fsn.Type() {
201
case ft.TDirectory, ft.THAMTShard:
keystore/keystore.go
+1
-1
@@ -168,7 +168,7 @@ func (ks *FSKeystore) List() ([]string, error) {
168
if err == nil {
169
list = append(list, name)
170
} else {
171
- log.Warningf("Ignoring the invalid keyfile: %s", name)
171
+ log.Warnf("Ignoring the invalid keyfile: %s", name)
172
}
173
}
174
p2p/local.go
+1
-1
@@ -76,7 +76,7 @@ func (l *localListener) setupStream(local manet.Conn) {
76
remote, err := l.dial(l.ctx)
77
if err != nil {
78
local.Close()
79
- log.Warningf("failed to dial to remote %s/%s", l.peer.Pretty(), l.proto)
79
+ log.Warnf("failed to dial to remote %s/%s", l.peer.Pretty(), l.proto)
80
return
81
}
82
plugin/loader/load_unix.go
+1
-1
@@ -26,7 +26,7 @@ func linuxLoadFunc(pluginDir string) ([]iplugin.Plugin, error) {
26
}
27
if info.IsDir() {
28
if fi != pluginDir {
29
- log.Warningf("found directory inside plugins directory: %s", fi)
29
+ log.Warnf("found directory inside plugins directory: %s", fi)
30
}
31
return nil
32
}
repo/fsrepo/fsrepo.go
+2
-2
@@ -403,7 +403,7 @@ func (r *FSRepo) openDatastore() error {
403
return fmt.Errorf("required Datastore.Spec entry missing from config file")
404
}
405
if r.config.Datastore.NoSync {
406
- log.Warning("NoSync is now deprecated in favor of datastore specific settings. If you want to disable fsync on flatfs set 'sync' to false. See https://github.com/ipfs/go-ipfs/blob/master/docs/datastores.md#flatfs.")
406
+ log.Warn("NoSync is now deprecated in favor of datastore specific settings. If you want to disable fsync on flatfs set 'sync' to false. See https://github.com/ipfs/go-ipfs/blob/master/docs/datastores.md#flatfs.")
407
}
408
409
dsc, err := AnyDatastoreConfig(r.config.Datastore.Spec)
@@ -457,7 +457,7 @@ func (r *FSRepo) Close() error {
457
458
err := os.Remove(filepath.Join(r.path, apiFile))
459
if err != nil && !os.IsNotExist(err) {
460
- log.Warning("error removing api file: ", err)
460
+ log.Warn("error removing api file: ", err)
461
}
462
463
if err := r.ds.Close(); err != nil {