Skip to content

Commit a53d480

Browse files
committed
fix: migrate from deprecated warning function
1 parent c2d1f3a commit a53d480

File tree

20 files changed

+25
-25
lines changed

20 files changed

+25
-25
lines changed

cmd/ipfs/daemon.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -227,7 +227,7 @@ func daemonFunc(req *cmds.Request, re cmds.ResponseEmitter, env cmds.Environment
227227
// check transport encryption flag.
228228
unencrypted, _ := req.Options[unencryptTransportKwd].(bool)
229229
if unencrypted {
230-
log.Warningf(`Running with --%s: All connections are UNENCRYPTED.
230+
log.Warnf(`Running with --%s: All connections are UNENCRYPTED.
231231
You will not be able to connect to regular encrypted networks.`, unencryptTransportKwd)
232232
}
233233

core/bootstrap/bootstrap.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@ func Bootstrap(id peer.ID, host host.Host, rt routing.Routing, cfg BootstrapConf
8080
if len(cfg.BootstrapPeers()) == 0 {
8181
// We *need* to bootstrap but we have no bootstrap peers
8282
// 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")
8484
}
8585

8686
// the periodic bootstrap function -- the connection supervisor

core/commands/add.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -286,7 +286,7 @@ You can now check what blocks have been created by:
286286
go func() {
287287
size, err := req.Files.Size()
288288
if err != nil {
289-
log.Warningf("error getting files size: %s", err)
289+
log.Warnf("error getting files size: %s", err)
290290
// see comment above
291291
return
292292
}

core/commands/cat.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,7 @@ var CatCmd = &cmds.Command{
104104
return err
105105
}
106106
default:
107-
log.Warningf("cat postrun: received unexpected type %T", val)
107+
log.Warnf("cat postrun: received unexpected type %T", val)
108108
}
109109
}
110110
},

core/core.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -143,7 +143,7 @@ func (n *IpfsNode) Bootstrap(cfg bootstrap.BootstrapConfig) error {
143143
cfg.BootstrapPeers = func() []peer.AddrInfo {
144144
ps, err := n.loadBootstrapPeers()
145145
if err != nil {
146-
log.Warning("failed to parse bootstrap peers from config")
146+
log.Warn("failed to parse bootstrap peers from config")
147147
return nil
148148
}
149149
return ps

core/corehttp/commands.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ var defaultLocalhostOrigins = []string{
4747
func addCORSFromEnv(c *cmdsHttp.ServerConfig) {
4848
origin := os.Getenv(originEnvKey)
4949
if origin != "" {
50-
log.Warning(originEnvKeyDeprecate)
50+
log.Warn(originEnvKeyDeprecate)
5151
c.AppendAllowedOrigins(origin)
5252
}
5353
}

core/corehttp/gateway_handler.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -610,7 +610,7 @@ func webError(w http.ResponseWriter, message string, err error, defaultCode int)
610610
func webErrorWithCode(w http.ResponseWriter, message string, err error, code int) {
611611
http.Error(w, fmt.Sprintf("%s: %s", message, err), code)
612612
if code >= 500 {
613-
log.Warningf("server error: %s: %s", err)
613+
log.Warnf("server error: %s: %s", err)
614614
}
615615
}
616616

core/corerepo/gc.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -212,7 +212,7 @@ func (gc *GC) maybeGC(ctx context.Context, offset uint64) error {
212212

213213
if storage+offset > gc.StorageGC {
214214
if storage+offset > gc.StorageMax {
215-
log.Warningf("pre-GC: %s", ErrMaxStorageExceeded)
215+
log.Warnf("pre-GC: %s", ErrMaxStorageExceeded)
216216
}
217217

218218
// Do GC here

core/node/libp2p/discovery.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ func (dh *discoveryHandler) HandlePeerFound(p peer.AddrInfo) {
2424
ctx, cancel := context.WithTimeout(dh.ctx, discoveryConnTimeout)
2525
defer cancel()
2626
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)
2828
}
2929
}
3030

core/node/libp2p/pnet.go

+2-2
Original file line numberDiff line numberDiff line change
@@ -51,8 +51,8 @@ func PNetChecker(repo repo.Repo, ph host.Host, lc fx.Lifecycle) error {
5151
select {
5252
case <-t.C:
5353
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.")
5656
}
5757
case <-done:
5858
return

core/node/libp2p/smux.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ func makeSmuxTransportOption(mplexExp bool) libp2p.Option {
3636
for _, id := range order {
3737
tpt, ok := muxers[id]
3838
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)
4040
continue
4141
}
4242
delete(muxers, id)

core/node/libp2p/transport.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ func Security(enabled, preferTLS bool) interface{} {
1515
if !enabled {
1616
return func() (opts Libp2pOpts) {
1717
// 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.
1919
You will not be able to connect to any nodes configured to use encrypted connections`)
2020
opts.Opts = append(opts.Opts, libp2p.NoSecurity)
2121
return opts

fuse/ipns/ipns_unix.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -201,7 +201,7 @@ func (s *Root) Lookup(ctx context.Context, name string) (fs.Node, error) {
201201
ipnsName := "/ipns/" + name
202202
resolved, err := s.Ipfs.Namesys.Resolve(s.Ipfs.Context(), ipnsName)
203203
if err != nil {
204-
log.Warningf("ipns: namesys resolve error: %s", err)
204+
log.Warnf("ipns: namesys resolve error: %s", err)
205205
return nil, fuse.ENOENT
206206
}
207207

fuse/mount/fuse.go

+2-2
Original file line numberDiff line numberDiff line change
@@ -110,15 +110,15 @@ func (m *mount) unmount() error {
110110
m.setActive(false)
111111
return nil
112112
}
113-
log.Warningf("fuse unmount err: %s", err)
113+
log.Warnf("fuse unmount err: %s", err)
114114

115115
// try closing the fuseConn
116116
err = m.fuseConn.Close()
117117
if err == nil {
118118
m.setActive(false)
119119
return nil
120120
}
121-
log.Warningf("fuse conn error: %s", err)
121+
log.Warnf("fuse conn error: %s", err)
122122

123123
// try mount.ForceUnmountManyTimes
124124
if err := ForceUnmountManyTimes(m, 10); err != nil {

fuse/mount/mount.go

+2-2
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ type Mount interface {
3636
// It does so by calling diskutil or fusermount directly.
3737
func ForceUnmount(m Mount) error {
3838
point := m.MountPoint()
39-
log.Warningf("Force-Unmounting %s...", point)
39+
log.Warnf("Force-Unmounting %s...", point)
4040

4141
cmd, err := UnmountCmd(point)
4242
if err != nil {
@@ -98,7 +98,7 @@ type closer struct {
9898
}
9999

100100
func (c *closer) Close() error {
101-
log.Warning(" (c *closer) Close(),", c.M.MountPoint())
101+
log.Warn(" (c *closer) Close(),", c.M.MountPoint())
102102
return c.M.Unmount()
103103
}
104104

fuse/readonly/readonly_unix.go

+2-2
Original file line numberDiff line numberDiff line change
@@ -186,7 +186,7 @@ func (s *Node) ReadDirAll(ctx context.Context) ([]fuse.Dirent, error) {
186186
}
187187
nd, err := s.Ipfs.DAG.Get(ctx, lnk.Cid)
188188
if err != nil {
189-
log.Warning("error fetching directory child node: ", err)
189+
log.Warn("error fetching directory child node: ", err)
190190
}
191191

192192
t := fuse.DT_Unknown
@@ -195,7 +195,7 @@ func (s *Node) ReadDirAll(ctx context.Context) ([]fuse.Dirent, error) {
195195
t = fuse.DT_File
196196
case *mdag.ProtoNode:
197197
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)
199199
} else {
200200
switch fsn.Type() {
201201
case ft.TDirectory, ft.THAMTShard:

keystore/keystore.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -168,7 +168,7 @@ func (ks *FSKeystore) List() ([]string, error) {
168168
if err == nil {
169169
list = append(list, name)
170170
} else {
171-
log.Warningf("Ignoring the invalid keyfile: %s", name)
171+
log.Warnf("Ignoring the invalid keyfile: %s", name)
172172
}
173173
}
174174

p2p/local.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ func (l *localListener) setupStream(local manet.Conn) {
7676
remote, err := l.dial(l.ctx)
7777
if err != nil {
7878
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)
8080
return
8181
}
8282

plugin/loader/load_unix.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ func linuxLoadFunc(pluginDir string) ([]iplugin.Plugin, error) {
2626
}
2727
if info.IsDir() {
2828
if fi != pluginDir {
29-
log.Warningf("found directory inside plugins directory: %s", fi)
29+
log.Warnf("found directory inside plugins directory: %s", fi)
3030
}
3131
return nil
3232
}

repo/fsrepo/fsrepo.go

+2-2
Original file line numberDiff line numberDiff line change
@@ -403,7 +403,7 @@ func (r *FSRepo) openDatastore() error {
403403
return fmt.Errorf("required Datastore.Spec entry missing from config file")
404404
}
405405
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.")
407407
}
408408

409409
dsc, err := AnyDatastoreConfig(r.config.Datastore.Spec)
@@ -457,7 +457,7 @@ func (r *FSRepo) Close() error {
457457

458458
err := os.Remove(filepath.Join(r.path, apiFile))
459459
if err != nil && !os.IsNotExist(err) {
460-
log.Warning("error removing api file: ", err)
460+
log.Warn("error removing api file: ", err)
461461
}
462462

463463
if err := r.ds.Close(); err != nil {

0 commit comments

Comments
 (0)