-
Notifications
You must be signed in to change notification settings - Fork 625
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore: Improved logging in IBC Core (#2976)
- Loading branch information
Showing
6 changed files
with
102 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
package logging | ||
|
||
import ( | ||
"fmt" | ||
|
||
sdk "github.com/cosmos/cosmos-sdk/types" | ||
) | ||
|
||
// SdkEventsToLogArguments converts a given sdk.Events and returns a slice of strings that provide human | ||
// readable values for the event attributes. | ||
func SdkEventsToLogArguments(events sdk.Events) []string { | ||
logArgs := []string{"events"} | ||
for _, e := range events { | ||
logArgs = append(logArgs, fmt.Sprintf("type=%s", e.Type)) | ||
for _, attr := range e.Attributes { | ||
if len(attr.Value) == 0 { | ||
continue | ||
} | ||
logArgs = append(logArgs, fmt.Sprintf("%s=%s", attr.Key, attr.Value)) | ||
} | ||
} | ||
return logArgs | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.