-
Notifications
You must be signed in to change notification settings - Fork 5
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
Logging improvement #13
Conversation
config/config.go
Outdated
@@ -24,23 +24,30 @@ var ( | |||
) | |||
|
|||
const Version = "v0.1.5" | |||
const UsageOracleKey = "Set the oracle server key file path." | |||
const UsagePluginConf = "Set the plugins' configuration file path." |
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.
type plugins' ==> plugin's
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.
type plugins' ==> plugin's
Resolved in bd07764
oracle_server/oracle_server.go
Outdated
@@ -391,7 +392,7 @@ func (os *OracleServer) reportWithCommitment(newRound uint64, lastRoundData *typ | |||
return err | |||
} | |||
|
|||
os.logger.Info("oracle client left fund", "balance", balance.String()) | |||
os.logger.Info("oracle server account left fund", "address", os.key.Address, "balance", balance.String()) |
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.
"left fund" can be removed from the log. Or say remaining balance. there is a balance field getting printed sperately.
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.
"left fund" can be removed from the log. Or say remaining balance. there is a balance field getting printed sperately.
Resolved in bd07764
@@ -407,7 +408,7 @@ func (os *OracleServer) reportWithoutCommitment(lastRoundData *types.RoundData) | |||
os.logger.Error("do report", "error", err.Error()) | |||
return err | |||
} | |||
os.logger.Info("report without commitment", "TX hash", tx.Hash(), "Nonce", tx.Nonce()) | |||
os.logger.Info("reported last round data and without current round commitment", "TX hash", tx.Hash(), "Nonce", tx.Nonce()) |
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.
Should this be info, Or Debug?
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.
Should this be info, Or Debug?
It could be info, because this is the last report of an oracle node who is no longer in the committee due to the epoch rotation.
oracle_server/oracle_server.go
Outdated
@@ -472,7 +473,7 @@ func (os *OracleServer) buildRoundData(round uint64) (*types.RoundData, error) { | |||
for _, s := range os.protocolSymbols { | |||
p, err := os.aggregatePrice(s, int64(os.curSampleTS)) | |||
if err != nil { | |||
os.logger.Error("aggregatePrice", "error", err.Error(), "symbol", s) | |||
os.logger.Warn("aggregatePrice", "error", err.Error(), "symbol", s) |
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.
If this is a warning. Maybe we should not say error in the message itself. 'price aggregation failed due to "err.Error()"'. Also it should only be warning if there is something to fix/actionable item from end-user point of view. Else this can be a debug
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.
If this is a warning. Maybe we should not say error in the message itself. 'price aggregation failed due to "err.Error()"'. Also it should only be warning if there is something to fix/actionable item from end-user point of view. Else this can be a debug
Resolved in bd07764
oracle_server/oracle_server.go
Outdated
@@ -691,18 +687,17 @@ func (os *OracleServer) tryLoadingNewPlugin(f fs.FileInfo, plugConf types.Plugin | |||
return | |||
} | |||
|
|||
os.logger.Info("** Replacing legacy plugin with new one: ", f.Name(), f.Mode().String()) |
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.
Why do we use ** in the log? Is it to put more emphasis on this specific log statement?
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.
Why do we use ** in the log? Is it to put more emphasis on this specific log statement?
Yes, it put more emphasis on the testing phase, since this feature is stable, I will remove the stars.
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.
Why do we use ** in the log? Is it to put more emphasis on this specific log statement?
Resolved in bd07764
plugin_wrapper/plugin_wrapper.go
Outdated
return err | ||
} | ||
|
||
if len(report.BadSymbols) != 0 { | ||
pw.logger.Warn("find bad symbols: ", report.BadSymbols) | ||
if len(report.UnRecognizeSymbols) != 0 { |
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 think the correct word would be unrecognizable
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 think the correct word would be unrecognizable
Resolved in bd07764
oracle_server/oracle_server.go
Outdated
pluginWrapper := pWrapper.NewPluginWrapper(os.loggingLevel, f.Name(), os.pluginDIR, os) | ||
if err := pluginWrapper.Initialize(); err != nil { | ||
os.logger.Error("** Cannot initialize plugin", "name", f.Name(), "error", err.Error()) | ||
os.logger.Error("Cannot initialize plugin", "name", f.Name(), "error", err.Error()) |
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 think the first Capital letter is not consistent with other logs and also not the preferred logging style in most golang projects. logging is usually the lowercase. Consistent casing is useful while filtering logs
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 think the first Capital letter is not consistent with other logs and also not the preferred logging style in most golang projects. logging is usually the lowercase. Consistent casing is useful while filtering logs
Resolved in bd07764
oracle_server/oracle_server.go
Outdated
@@ -714,11 +709,11 @@ func (os *OracleServer) ApplyPluginConf(name string, plugConf types.PluginConfig | |||
// set the plugin configuration via system env, thus the plugin can load it on startup. | |||
conf, err := json.Marshal(plugConf) | |||
if err != nil { | |||
os.logger.Error("** Cannot marshal plugin's configuration", "error", err.Error()) | |||
os.logger.Error("Cannot marshal plugin's configuration", "error", err.Error()) |
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.
same here, other places too
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.
same here, other places too
Resolved in bd07764
plugins/binance/binance.go
Outdated
@@ -35,12 +34,12 @@ type BIClient struct { | |||
func NewBIClient(conf *types.PluginConfig) *BIClient { | |||
client := common.NewClient(conf.Key, time.Second*time.Duration(conf.Timeout), conf.Endpoint) | |||
if client == nil { |
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.
In what cases, is this possible?
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.
In what cases, is this possible?
I doubled checked, it is not possible.
Resolved in bd07764
To close #10, this PR contains: