-
Notifications
You must be signed in to change notification settings - Fork 20.5k
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
build, contracts, log, metrics, p2p, rpc: changes necessary by swarm-network-rewrite #16898
Changes from 3 commits
9936d80
9baa7c5
26037fd
c779956
d8b75b4
b841feb
9f7306f
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -31,31 +31,36 @@ func Root() Logger { | |
|
||
// Trace is a convenient alias for Root().Trace | ||
func Trace(msg string, ctx ...interface{}) { | ||
root.write(msg, LvlTrace, ctx) | ||
root.write(msg, LvlTrace, ctx, skipLevel) | ||
} | ||
|
||
// Debug is a convenient alias for Root().Debug | ||
func Debug(msg string, ctx ...interface{}) { | ||
root.write(msg, LvlDebug, ctx) | ||
root.write(msg, LvlDebug, ctx, skipLevel) | ||
} | ||
|
||
// Info is a convenient alias for Root().Info | ||
func Info(msg string, ctx ...interface{}) { | ||
root.write(msg, LvlInfo, ctx) | ||
root.write(msg, LvlInfo, ctx, skipLevel) | ||
} | ||
|
||
// Warn is a convenient alias for Root().Warn | ||
func Warn(msg string, ctx ...interface{}) { | ||
root.write(msg, LvlWarn, ctx) | ||
root.write(msg, LvlWarn, ctx, skipLevel) | ||
} | ||
|
||
// Error is a convenient alias for Root().Error | ||
func Error(msg string, ctx ...interface{}) { | ||
root.write(msg, LvlError, ctx) | ||
root.write(msg, LvlError, ctx, skipLevel) | ||
} | ||
|
||
// Crit is a convenient alias for Root().Crit | ||
func Crit(msg string, ctx ...interface{}) { | ||
root.write(msg, LvlCrit, ctx) | ||
root.write(msg, LvlCrit, ctx, skipLevel) | ||
os.Exit(1) | ||
} | ||
|
||
// Output is a convenient alias for write | ||
func Output(msg string, lvl Lvl, skip int, ctx ...interface{}) { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This, together with the change of the API of There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This is not a good idea IMHO. Line numbers aren't even shown by default, so optimising for them is weird. Even if they're shown, i would expect to find a log statement at the line number. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We are using I don't really see anything wrong with having a different There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. To add to this, we are always using the log lines in Swarm, so that we track all ERRORs and WARNs and fix them. Our definition for ERROR is something that a developer must look at, whereas WARN might be a problem or not, depending on circumstances. Therefore it is important to have meaningful traces with filenames:line in logs. |
||
root.write(msg, lvl, ctx, skip) | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -47,8 +47,8 @@ func TestTimerStop(t *testing.T) { | |
func TestTimerFunc(t *testing.T) { | ||
tm := NewTimer() | ||
tm.Time(func() { time.Sleep(50e6) }) | ||
if max := tm.Max(); 35e6 > max || max > 95e6 { | ||
t.Errorf("tm.Max(): 35e6 > %v || %v > 95e6\n", max, max) | ||
if max := tm.Max(); 35e6 > max || max > 145e6 { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
|
||
t.Errorf("tm.Max(): 35e6 > %v || %v > 145e6\n", max, max) | ||
} | ||
} | ||
|
||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -594,13 +594,13 @@ running: | |
// This channel is used by AddPeer to add to the | ||
// ephemeral static peer list. Add it to the dialer, | ||
// it will keep the node connected. | ||
srv.log.Debug("Adding static node", "node", n) | ||
srv.log.Trace("Adding static node", "node", n) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I don't understand why those changes are needed. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We are just downgrading the level of those particular logs, because they are quite spammy. I understand that we might have different understanding of what |
||
dialstate.addStatic(n) | ||
case n := <-srv.removestatic: | ||
// This channel is used by RemovePeer to send a | ||
// disconnect request to a peer and begin the | ||
// stop keeping the node connected | ||
srv.log.Debug("Removing static node", "node", n) | ||
srv.log.Trace("Removing static node", "node", n) | ||
dialstate.removeStatic(n) | ||
if p, ok := peers[n.ID]; ok { | ||
p.Disconnect(DiscRequested) | ||
|
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.
Please use a shorter deadline like 2m
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.
Done. I hope this is enough for the
ethersphere
repo.