forked from TrueCloudLab/frostfs-node
[#807] event/listener: Add event information to error logs
Signed-off-by: Pavel Karpy <carpawell@nspcc.ru>
This commit is contained in:
parent
ffde45d164
commit
45aac7bb7f
1 changed files with 15 additions and 10 deletions
|
@ -368,6 +368,11 @@ func (l listener) parseAndHandleNotary(nr *response.NotaryRequestEvent) {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
log := l.log.With(
|
||||||
|
zap.String("contract", notaryEvent.ScriptHash().StringLE()),
|
||||||
|
zap.Stringer("method", notaryEvent.Type()),
|
||||||
|
)
|
||||||
|
|
||||||
notaryKey := notaryRequestTypes{}
|
notaryKey := notaryRequestTypes{}
|
||||||
notaryKey.SetMempoolType(nr.Type)
|
notaryKey.SetMempoolType(nr.Type)
|
||||||
notaryKey.SetRequestType(notaryEvent.Type())
|
notaryKey.SetRequestType(notaryEvent.Type())
|
||||||
|
@ -379,7 +384,7 @@ func (l listener) parseAndHandleNotary(nr *response.NotaryRequestEvent) {
|
||||||
l.mtx.RUnlock()
|
l.mtx.RUnlock()
|
||||||
|
|
||||||
if !ok {
|
if !ok {
|
||||||
l.log.Debug("notary parser not set")
|
log.Debug("notary parser not set")
|
||||||
|
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
@ -387,7 +392,7 @@ func (l listener) parseAndHandleNotary(nr *response.NotaryRequestEvent) {
|
||||||
// parse the notary event
|
// parse the notary event
|
||||||
event, err := parser(notaryEvent)
|
event, err := parser(notaryEvent)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
l.log.Warn("could not parse notary event",
|
log.Warn("could not parse notary event",
|
||||||
zap.String("error", err.Error()),
|
zap.String("error", err.Error()),
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -400,7 +405,7 @@ func (l listener) parseAndHandleNotary(nr *response.NotaryRequestEvent) {
|
||||||
l.mtx.RUnlock()
|
l.mtx.RUnlock()
|
||||||
|
|
||||||
if !ok {
|
if !ok {
|
||||||
l.log.Info("notary handlers for parsed notification event were not registered",
|
log.Info("notary handlers for parsed notification event were not registered",
|
||||||
zap.Any("event", event),
|
zap.Any("event", event),
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -416,8 +421,8 @@ func (l listener) parseAndHandleNotary(nr *response.NotaryRequestEvent) {
|
||||||
// Ignores the parser if listener is started.
|
// Ignores the parser if listener is started.
|
||||||
func (l listener) SetNotificationParser(pi NotificationParserInfo) {
|
func (l listener) SetNotificationParser(pi NotificationParserInfo) {
|
||||||
log := l.log.With(
|
log := l.log.With(
|
||||||
zap.String("script hash LE", pi.ScriptHash().StringLE()),
|
zap.String("contract", pi.ScriptHash().StringLE()),
|
||||||
zap.Stringer("event type", pi.getType()),
|
zap.Stringer("event_type", pi.getType()),
|
||||||
)
|
)
|
||||||
|
|
||||||
parser := pi.parser()
|
parser := pi.parser()
|
||||||
|
@ -449,8 +454,8 @@ func (l listener) SetNotificationParser(pi NotificationParserInfo) {
|
||||||
// Ignores handlers of event without parser.
|
// Ignores handlers of event without parser.
|
||||||
func (l listener) RegisterNotificationHandler(hi NotificationHandlerInfo) {
|
func (l listener) RegisterNotificationHandler(hi NotificationHandlerInfo) {
|
||||||
log := l.log.With(
|
log := l.log.With(
|
||||||
zap.String("script hash LE", hi.ScriptHash().StringLE()),
|
zap.String("contract", hi.ScriptHash().StringLE()),
|
||||||
zap.Stringer("event type", hi.GetType()),
|
zap.Stringer("event_type", hi.GetType()),
|
||||||
)
|
)
|
||||||
|
|
||||||
handler := hi.Handler()
|
handler := hi.Handler()
|
||||||
|
@ -512,7 +517,7 @@ func (l listener) SetNotaryParser(pi NotaryParserInfo) {
|
||||||
|
|
||||||
log := l.log.With(
|
log := l.log.With(
|
||||||
zap.Stringer("mempool_type", pi.GetMempoolType()),
|
zap.Stringer("mempool_type", pi.GetMempoolType()),
|
||||||
zap.Stringer("script_hash", pi.ScriptHash()),
|
zap.String("contract", pi.ScriptHash().StringLE()),
|
||||||
zap.Stringer("notary_type", pi.RequestType()),
|
zap.Stringer("notary_type", pi.RequestType()),
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -549,8 +554,8 @@ func (l listener) RegisterNotaryHandler(hi NotaryHandlerInfo) {
|
||||||
}
|
}
|
||||||
|
|
||||||
log := l.log.With(
|
log := l.log.With(
|
||||||
zap.Stringer("mempool type", hi.GetMempoolType()),
|
zap.Stringer("mempool_type", hi.GetMempoolType()),
|
||||||
zap.Stringer("script_hash", hi.ScriptHash()),
|
zap.String("contract", hi.ScriptHash().StringLE()),
|
||||||
zap.Stringer("notary type", hi.RequestType()),
|
zap.Stringer("notary type", hi.RequestType()),
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue