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

[Logging] Document on-chain logging best practices #856

Open
4 tasks
Tracked by #384
bryanchriswhite opened this issue Oct 4, 2024 · 0 comments
Open
4 tasks
Tracked by #384

[Logging] Document on-chain logging best practices #856

bryanchriswhite opened this issue Oct 4, 2024 · 0 comments
Assignees
Labels
on-chain On-chain business logic

Comments

@bryanchriswhite
Copy link
Contributor

bryanchriswhite commented Oct 4, 2024

Objective

Document on-chain logging best practices; e.g.:

 logger = logger.With(
 	"session_id", sessionHeader.GetSessionId(),
 	"session_end_height", sessionHeader.GetSessionEndBlockHeight(),
 	"supplier", supplierAddr)
 logger.Info("validated the submitProof message ")

Consider which logger should be used:

  1. The default cosmos-sdk logger is not very practical when used at the "debug" level as it's overwhelmed with cosmos-sdk specific output.
  2. We should prefer using the "debug" level for any log that doesn't require node operator attention (e.g. handling invalid requests). I think this represents (or it should) the majority of logger calls.

Search each module for usages of logger.Info() and logger.Error(). Places where an error is logged and returned are prime examples of mis-leveled logs.

Origin Document

image

Goals

  • Establish and document the purpose of each log level and when each SHOULD be used, on-chain.
  • Document the validator UX stakeholders and their overlapping and distinct/competing concerns.

Deliverables

  • A PR which updates the docusaurus docs to include a breakdown of the on-chain logging levels and their conventional usage.
  • A PR which updates the docusaurus docs to include an overview (and possibly a diagram) of validator UX stakeholders and their concerns.

Non-goals / Non-deliverables

  • Updating any logs to be consistent with this documentation.

General deliverables

  • Comments: Add/update TODOs and comments alongside the source code so it is easier to follow.
  • Documentation: Update architectural or development READMEs; use mermaid diagrams where appropriate.

Creator: @bryanchriswhite
Co-Owners: @Olshansk

@bryanchriswhite bryanchriswhite changed the title [Logging] Document how on-chain logging should be done as a best practice. For example [Logging] Document how on-chain logging should be done as a best practice Oct 4, 2024
@bryanchriswhite bryanchriswhite self-assigned this Oct 4, 2024
@bryanchriswhite bryanchriswhite added the on-chain On-chain business logic label Oct 4, 2024
@bryanchriswhite bryanchriswhite changed the title [Logging] Document how on-chain logging should be done as a best practice [Logging] Document on-chain logging best practices Oct 4, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
on-chain On-chain business logic
Projects
Status: 🔖 Ready
Development

No branches or pull requests

1 participant