@cryptotaxi247 / kubo / commits / 78b6cc5f2

Replace Critical{,f} with Error{,f}

Except when there is an explicit os.Exit(1) after the Critical line, then replace with Fatal{,f}. golang's log and logrus already call os.Exit(1) by default with Fatal. License: MIT Signed-off-by: rht <rhtbot@gmail.com>

rht committed Jun 12, 2015 at 04:36 UTC 78b6cc5f2d67e422d14a96130f4c1ee1fd3ab8ae
9 files changed +12 -15
cmd/ipfs/main.go
+1 -1
@@ -465,7 +465,7 @@ func startProfiling() (func(), error) {
465 for _ = range time.NewTicker(time.Second * 30).C {
466 err := writeHeapProfileToFile()
467 if err != nil {
468 - log.Critical(err)
468 + log.Error(err)
469 }
470 }
471 }()
core/commands/log.go
+1 -1
@@ -45,7 +45,7 @@ output of a running daemon.
45 // TODO use a different keyword for 'all' because all can theoretically
46 // clash with a subsystem name
47 cmds.StringArg("subsystem", true, false, fmt.Sprintf("the subsystem logging identifier. Use '%s' for all subsystems.", logAllKeyword)),
48 - cmds.StringArg("level", true, false, "one of: debug, info, notice, warning, error, critical"),
48 + cmds.StringArg("level", true, false, "one of: debug, info, notice, warning, error, fatal"),
49 },
50 Run: func(req cmds.Request, res cmds.Response) {
51
fuse/ipns/ipns_unix.go
+2 -2
@@ -462,10 +462,10 @@ func (dir *Directory) Rename(ctx context.Context, req *fuse.RenameRequest, newDi
462 return err
463 }
464 case *File:
465 - log.Critical("Cannot move node into a file!")
465 + log.Error("Cannot move node into a file!")
466 return fuse.EPERM
467 default:
468 - log.Critical("Unknown node type for rename target dir!")
468 + log.Error("Unknown node type for rename target dir!")
469 return errors.New("Unknown fs node type!")
470 }
471 return nil
ipnsfs/system.go
+1 -1
@@ -285,7 +285,7 @@ func (np *Republisher) Run(ctx context.Context) {
285 log.Info("Publishing Changes!")
286 err := np.root.Publish(ctx)
287 if err != nil {
288 - log.Critical("republishRoot error: %s", err)
288 + log.Error("republishRoot error: %s", err)
289 }
290
291 case <-ctx.Done():
p2p/test/util/key.go
+4 -4
@@ -24,7 +24,7 @@ type TestBogusPrivateKey []byte
24 type TestBogusPublicKey []byte
25
26 func (pk TestBogusPublicKey) Verify(data, sig []byte) (bool, error) {
27 - log.Criticalf("TestBogusPublicKey.Verify -- this better be a test!")
27 + log.Errorf("TestBogusPublicKey.Verify -- this better be a test!")
28 return bytes.Equal(data, reverse(sig)), nil
29 }
30
@@ -33,7 +33,7 @@ func (pk TestBogusPublicKey) Bytes() ([]byte, error) {
33 }
34
35 func (pk TestBogusPublicKey) Encrypt(b []byte) ([]byte, error) {
36 - log.Criticalf("TestBogusPublicKey.Encrypt -- this better be a test!")
36 + log.Errorf("TestBogusPublicKey.Encrypt -- this better be a test!")
37 return reverse(b), nil
38 }
39
@@ -51,7 +51,7 @@ func (sk TestBogusPrivateKey) GenSecret() []byte {
51 }
52
53 func (sk TestBogusPrivateKey) Sign(message []byte) ([]byte, error) {
54 - log.Criticalf("TestBogusPrivateKey.Sign -- this better be a test!")
54 + log.Errorf("TestBogusPrivateKey.Sign -- this better be a test!")
55 return reverse(message), nil
56 }
57
@@ -60,7 +60,7 @@ func (sk TestBogusPrivateKey) GetPublic() ic.PubKey {
60 }
61
62 func (sk TestBogusPrivateKey) Decrypt(b []byte) ([]byte, error) {
63 - log.Criticalf("TestBogusPrivateKey.Decrypt -- this better be a test!")
63 + log.Errorf("TestBogusPrivateKey.Decrypt -- this better be a test!")
64 return reverse(b), nil
65 }
66
routing/dht/handlers.go
+1 -1
@@ -89,7 +89,7 @@ func (dht *IpfsDHT) handleGetValue(ctx context.Context, p peer.ID, pmes *pb.Mess
89 for _, pi := range closerinfos {
90 log.Debugf("handleGetValue returning closer peer: '%s'", pi.ID)
91 if len(pi.Addrs) < 1 {
92 - log.Criticalf(`no addresses on peer being sent!
92 + log.Errorf(`no addresses on peer being sent!
93 [local:%s]
94 [sending:%s]
95 [remote:%s]`, dht.self, pi.ID, p)
routing/supernode/proxy/standard.go
+1 -1
@@ -50,7 +50,7 @@ func (px *standard) Bootstrap(ctx context.Context) error {
50 cxns = append(cxns, info)
51 }
52 if len(cxns) == 0 {
53 - log.Critical("unable to bootstrap to any supernode routers")
53 + log.Error("unable to bootstrap to any supernode routers")
54 } else {
55 log.Infof("bootstrapped to %d supernode routers: %s", len(cxns), cxns)
56 }
thirdparty/eventlog/log.go
-2
@@ -11,8 +11,6 @@ import (
11 // StandardLogger provides API compatibility with standard printf loggers
12 // eg. go-logging
13 type StandardLogger interface {
14 - Critical(args ...interface{})
15 - Criticalf(format string, args ...interface{})
14 Debug(args ...interface{})
15 Debugf(format string, args ...interface{})
16 Error(args ...interface{})
updates/updates.go
+1 -2
@@ -90,8 +90,7 @@ func init() {
90 var err error
91 currentVersion, err = parseVersion()
92 if err != nil {
93 - log.Criticalf("invalid version number in code (must be semver): %q", Version)
94 - os.Exit(1)
93 + log.Fatalf("invalid version number in code (must be semver): %q", Version)
94 }
95 log.Infof("go-ipfs Version: %s", currentVersion)
96 }