Skip to content

Commit

Permalink
fix: migrate from deprecated warning function
Browse files Browse the repository at this point in the history
  • Loading branch information
Stebalien committed Jan 29, 2020
1 parent c2d1f3a commit a53d480
Show file tree
Hide file tree
Showing 20 changed files with 25 additions and 25 deletions.
2 changes: 1 addition & 1 deletion cmd/ipfs/daemon.go
Expand Up @@ -227,7 +227,7 @@ func daemonFunc(req *cmds.Request, re cmds.ResponseEmitter, env cmds.Environment
// check transport encryption flag.
unencrypted, _ := req.Options[unencryptTransportKwd].(bool)
if unencrypted {
log.Warningf(`Running with --%s: All connections are UNENCRYPTED.
log.Warnf(`Running with --%s: All connections are UNENCRYPTED.
You will not be able to connect to regular encrypted networks.`, unencryptTransportKwd)
}

Expand Down
2 changes: 1 addition & 1 deletion core/bootstrap/bootstrap.go
Expand Up @@ -80,7 +80,7 @@ func Bootstrap(id peer.ID, host host.Host, rt routing.Routing, cfg BootstrapConf
if len(cfg.BootstrapPeers()) == 0 {
// We *need* to bootstrap but we have no bootstrap peers
// configured *at all*, inform the user.
log.Warning("no bootstrap nodes configured: go-ipfs may have difficulty connecting to the network")
log.Warn("no bootstrap nodes configured: go-ipfs may have difficulty connecting to the network")
}

// the periodic bootstrap function -- the connection supervisor
Expand Down
2 changes: 1 addition & 1 deletion core/commands/add.go
Expand Up @@ -286,7 +286,7 @@ You can now check what blocks have been created by:
go func() {
size, err := req.Files.Size()
if err != nil {
log.Warningf("error getting files size: %s", err)
log.Warnf("error getting files size: %s", err)
// see comment above
return
}
Expand Down
2 changes: 1 addition & 1 deletion core/commands/cat.go
Expand Up @@ -104,7 +104,7 @@ var CatCmd = &cmds.Command{
return err
}
default:
log.Warningf("cat postrun: received unexpected type %T", val)
log.Warnf("cat postrun: received unexpected type %T", val)
}
}
},
Expand Down
2 changes: 1 addition & 1 deletion core/core.go
Expand Up @@ -143,7 +143,7 @@ func (n *IpfsNode) Bootstrap(cfg bootstrap.BootstrapConfig) error {
cfg.BootstrapPeers = func() []peer.AddrInfo {
ps, err := n.loadBootstrapPeers()
if err != nil {
log.Warning("failed to parse bootstrap peers from config")
log.Warn("failed to parse bootstrap peers from config")
return nil
}
return ps
Expand Down
2 changes: 1 addition & 1 deletion core/corehttp/commands.go
Expand Up @@ -47,7 +47,7 @@ var defaultLocalhostOrigins = []string{
func addCORSFromEnv(c *cmdsHttp.ServerConfig) {
origin := os.Getenv(originEnvKey)
if origin != "" {
log.Warning(originEnvKeyDeprecate)
log.Warn(originEnvKeyDeprecate)
c.AppendAllowedOrigins(origin)
}
}
Expand Down
2 changes: 1 addition & 1 deletion core/corehttp/gateway_handler.go
Expand Up @@ -610,7 +610,7 @@ func webError(w http.ResponseWriter, message string, err error, defaultCode int)
func webErrorWithCode(w http.ResponseWriter, message string, err error, code int) {
http.Error(w, fmt.Sprintf("%s: %s", message, err), code)
if code >= 500 {
log.Warningf("server error: %s: %s", err)
log.Warnf("server error: %s: %s", err)
}
}

Expand Down
2 changes: 1 addition & 1 deletion core/corerepo/gc.go
Expand Up @@ -212,7 +212,7 @@ func (gc *GC) maybeGC(ctx context.Context, offset uint64) error {

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

// Do GC here
Expand Down
2 changes: 1 addition & 1 deletion core/node/libp2p/discovery.go
Expand Up @@ -24,7 +24,7 @@ func (dh *discoveryHandler) HandlePeerFound(p peer.AddrInfo) {
ctx, cancel := context.WithTimeout(dh.ctx, discoveryConnTimeout)
defer cancel()
if err := dh.host.Connect(ctx, p); err != nil {
log.Warningf("failed to connect to peer %s found by discovery: %s", p.ID, err)
log.Warnf("failed to connect to peer %s found by discovery: %s", p.ID, err)
}
}

Expand Down
4 changes: 2 additions & 2 deletions core/node/libp2p/pnet.go
Expand Up @@ -51,8 +51,8 @@ func PNetChecker(repo repo.Repo, ph host.Host, lc fx.Lifecycle) error {
select {
case <-t.C:
if len(ph.Network().Peers()) == 0 {
log.Warning("We are in private network and have no peers.")
log.Warning("This might be configuration mistake.")
log.Warn("We are in private network and have no peers.")
log.Warn("This might be configuration mistake.")
}
case <-done:
return
Expand Down
2 changes: 1 addition & 1 deletion core/node/libp2p/smux.go
Expand Up @@ -36,7 +36,7 @@ func makeSmuxTransportOption(mplexExp bool) libp2p.Option {
for _, id := range order {
tpt, ok := muxers[id]
if !ok {
log.Warning("unknown or duplicate muxer in LIBP2P_MUX_PREFS: %s", id)
log.Warn("unknown or duplicate muxer in LIBP2P_MUX_PREFS: %s", id)
continue
}
delete(muxers, id)
Expand Down
2 changes: 1 addition & 1 deletion core/node/libp2p/transport.go
Expand Up @@ -15,7 +15,7 @@ func Security(enabled, preferTLS bool) interface{} {
if !enabled {
return func() (opts Libp2pOpts) {
// TODO: shouldn't this be Errorf to guarantee visibility?
log.Warningf(`Your IPFS node has been configured to run WITHOUT ENCRYPTED CONNECTIONS.
log.Warnf(`Your IPFS node has been configured to run WITHOUT ENCRYPTED CONNECTIONS.
You will not be able to connect to any nodes configured to use encrypted connections`)
opts.Opts = append(opts.Opts, libp2p.NoSecurity)
return opts
Expand Down
2 changes: 1 addition & 1 deletion fuse/ipns/ipns_unix.go
Expand Up @@ -201,7 +201,7 @@ func (s *Root) Lookup(ctx context.Context, name string) (fs.Node, error) {
ipnsName := "/ipns/" + name
resolved, err := s.Ipfs.Namesys.Resolve(s.Ipfs.Context(), ipnsName)
if err != nil {
log.Warningf("ipns: namesys resolve error: %s", err)
log.Warnf("ipns: namesys resolve error: %s", err)
return nil, fuse.ENOENT
}

Expand Down
4 changes: 2 additions & 2 deletions fuse/mount/fuse.go
Expand Up @@ -110,15 +110,15 @@ func (m *mount) unmount() error {
m.setActive(false)
return nil
}
log.Warningf("fuse unmount err: %s", err)
log.Warnf("fuse unmount err: %s", err)

// try closing the fuseConn
err = m.fuseConn.Close()
if err == nil {
m.setActive(false)
return nil
}
log.Warningf("fuse conn error: %s", err)
log.Warnf("fuse conn error: %s", err)

// try mount.ForceUnmountManyTimes
if err := ForceUnmountManyTimes(m, 10); err != nil {
Expand Down
4 changes: 2 additions & 2 deletions fuse/mount/mount.go
Expand Up @@ -36,7 +36,7 @@ type Mount interface {
// It does so by calling diskutil or fusermount directly.
func ForceUnmount(m Mount) error {
point := m.MountPoint()
log.Warningf("Force-Unmounting %s...", point)
log.Warnf("Force-Unmounting %s...", point)

cmd, err := UnmountCmd(point)
if err != nil {
Expand Down Expand Up @@ -98,7 +98,7 @@ type closer struct {
}

func (c *closer) Close() error {
log.Warning(" (c *closer) Close(),", c.M.MountPoint())
log.Warn(" (c *closer) Close(),", c.M.MountPoint())
return c.M.Unmount()
}

Expand Down
4 changes: 2 additions & 2 deletions fuse/readonly/readonly_unix.go
Expand Up @@ -186,7 +186,7 @@ func (s *Node) ReadDirAll(ctx context.Context) ([]fuse.Dirent, error) {
}
nd, err := s.Ipfs.DAG.Get(ctx, lnk.Cid)
if err != nil {
log.Warning("error fetching directory child node: ", err)
log.Warn("error fetching directory child node: ", err)
}

t := fuse.DT_Unknown
Expand All @@ -195,7 +195,7 @@ func (s *Node) ReadDirAll(ctx context.Context) ([]fuse.Dirent, error) {
t = fuse.DT_File
case *mdag.ProtoNode:
if fsn, err := ft.FSNodeFromBytes(nd.Data()); err != nil {
log.Warning("failed to unmarshal protonode data field:", err)
log.Warn("failed to unmarshal protonode data field:", err)
} else {
switch fsn.Type() {
case ft.TDirectory, ft.THAMTShard:
Expand Down
2 changes: 1 addition & 1 deletion keystore/keystore.go
Expand Up @@ -168,7 +168,7 @@ func (ks *FSKeystore) List() ([]string, error) {
if err == nil {
list = append(list, name)
} else {
log.Warningf("Ignoring the invalid keyfile: %s", name)
log.Warnf("Ignoring the invalid keyfile: %s", name)
}
}

Expand Down
2 changes: 1 addition & 1 deletion p2p/local.go
Expand Up @@ -76,7 +76,7 @@ func (l *localListener) setupStream(local manet.Conn) {
remote, err := l.dial(l.ctx)
if err != nil {
local.Close()
log.Warningf("failed to dial to remote %s/%s", l.peer.Pretty(), l.proto)
log.Warnf("failed to dial to remote %s/%s", l.peer.Pretty(), l.proto)
return
}

Expand Down
2 changes: 1 addition & 1 deletion plugin/loader/load_unix.go
Expand Up @@ -26,7 +26,7 @@ func linuxLoadFunc(pluginDir string) ([]iplugin.Plugin, error) {
}
if info.IsDir() {
if fi != pluginDir {
log.Warningf("found directory inside plugins directory: %s", fi)
log.Warnf("found directory inside plugins directory: %s", fi)
}
return nil
}
Expand Down
4 changes: 2 additions & 2 deletions repo/fsrepo/fsrepo.go
Expand Up @@ -403,7 +403,7 @@ func (r *FSRepo) openDatastore() error {
return fmt.Errorf("required Datastore.Spec entry missing from config file")
}
if r.config.Datastore.NoSync {
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.")
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.")
}

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

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

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

0 comments on commit a53d480

Please sign in to comment.