-
-
Notifications
You must be signed in to change notification settings - Fork 3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Cleanup logging 1 #1359
Cleanup logging 1 #1359
Conversation
@@ -3,23 +3,21 @@ package util | |||
import ( | |||
"os" | |||
|
|||
logging "github.com/ipfs/go-ipfs/Godeps/_workspace/src/github.com/whyrusleeping/go-logging" | |||
"github.com/ipfs/go-ipfs/Godeps/_workspace/src/github.com/Sirupsen/logrus" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@whyrusleeping had you switched to go-logging
on purpose?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
i was under the assumption that we were using go-logging.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@whyrusleeping do you want to keep go-logging, or is logrus ok? (i dont care either way)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@jbenet irc logs and past issues say logrus is the preferred backend. Some of the logs are even in pure logrus. It's just that eventlog heavy logging needs to be toned down somehow.
The argument for go-logging is that it is more lightweight than logrus and more compatible with standard logging extra features (e.g. logrus's setflags feature is still pending).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
keep go-logging is euphemism for kill logrus (as this will be the course of action written in the commit message, not the former)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@rht at this point, you know more about them to make a better decision on the two. I'd say take the path of least resistance if theyre about the same.
"completely API compatible with the standard library logger" but doesn't have stdlib SetFlags is indeed surprising. sirupsen/logrus#63 |
8af084f
to
bc0183f
Compare
@rht, status update here? |
@whyrusleeping said:
so let's go with whatever you think is best, @rht. is that logrus + the changes here? |
@whyrusleeping There is a very specific error that happens here when I switch Critical{,f} with Fatalf{,f}. I'm bisecting on my previous commit (now that gpe is not running). The err is erring. Yes it is logrus + changes. |
@rht is the problem these:
?? it's because in logrus,
Our |
(I c, I did try changing to error, but not to all files...). So Fatal will be used when in the lines there are explicit exits. |
f9e4205
to
20b87d1
Compare
Test passes on the commit "Replace Critical with Error". The latest fail is only on the linux. |
@@ -96,7 +96,7 @@ func (pm *WantManager) SendBlock(ctx context.Context, env *engine.Envelope) { | |||
log.Infof("Sending block %s to %s", env.Peer, env.Block) | |||
err := pm.network.SendMessage(ctx, env.Peer, msg) | |||
if err != nil { | |||
log.Noticef("sendblock error: %s", err) | |||
log.Warningf("sendblock error: %s", err) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this should probably just be log.Infof
-- warnings are things the user may need to be conscious about
last couple changes. otherwise, this LGTM! |
@rht, make sure to rebase on latest master. we might merge @whyrusleeping's #1382 if it gets finished first. |
License: MIT Signed-off-by: rht <rhtbot@gmail.com>
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>
And substitute the lines using Notice{,f} with Info{,f} License: MIT Signed-off-by: rht <rhtbot@gmail.com>
License: MIT Signed-off-by: rht <rhtbot@gmail.com>
License: MIT Signed-off-by: rht <rhtbot@gmail.com>
License: MIT Signed-off-by: rht <rhtbot@gmail.com>
and exchange/bitswap/testutils.go License: MIT Signed-off-by: rht <rhtbot@gmail.com>
Fixed + rebased |
@rht this LGTM! and 👍 on all the go linting. |
thanks @rht! |
The golint was an excuse to rerun the travis. |
Remove prefixlog (totally unused) and go-logging (backend of util/log).
Now there are only util/log, eventlog, logrus left (util/log and eventlog use logrus as backend).
Side-effect: the logs don't have shortfile (because logrus doesn't use it), and the formatting is less flexible than go-logging. The former needs a fork, the latter only needs a custom formatter.
#593