Skip to content
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

Improve modules logging #483

Closed
RiccardoM opened this issue Jun 14, 2021 · 2 comments · Fixed by #486
Closed

Improve modules logging #483

RiccardoM opened this issue Jun 14, 2021 · 2 comments · Fixed by #486
Assignees
Labels
kind/enhancement Enhance an already existing feature; no "New feature" to add x/posts Post module x/profiles Module that allows to create and manage decentralized social profiles x/subspaces Issue on the x/subspaces module

Comments

@RiccardoM
Copy link
Contributor

Context

Currently the SDK modules are logging useful information using the Logger interface. This allows the node to print different levels of information when running (eg. debug, info, etc).

To make it easier for node operators to understand how their node is doing, we should implement logging into our modules as well when needed. This can be done by defining a new method for each keeper as follows:

func Logger() log.Logger {
  return ctx.Logger().With("module", fmt.Sprintf("x/%s", types.ModuleName))
}

Then, we can simply call the various methods (Info, Debug, ...):

logger.Info("asserted all invariants", "duration", diff, "height", ctx.BlockHeight())
@RiccardoM RiccardoM added kind/enhancement Enhance an already existing feature; no "New feature" to add x/posts Post module x/profiles Module that allows to create and manage decentralized social profiles x/subspaces Issue on the x/subspaces module labels Jun 14, 2021
@RiccardoM RiccardoM assigned RiccardoM and leobragaz and unassigned RiccardoM Jun 14, 2021
@leobragaz
Copy link
Contributor

@RiccardoM Should we also add logs to existent methods?

@RiccardoM
Copy link
Contributor Author

@bragaz Yes, logs should be added with different levels (Info, Warn, Debug etc) when we think it would be nice to have them

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind/enhancement Enhance an already existing feature; no "New feature" to add x/posts Post module x/profiles Module that allows to create and manage decentralized social profiles x/subspaces Issue on the x/subspaces module
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants