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

DOCS-1827: Update Go module logging examples #2632

Merged
merged 3 commits into from
Mar 12, 2024

Conversation

andf-viam
Copy link
Contributor

Update Golang logging example code for module creation docs

  • Including new example for CWarnw

@viambot viambot added the safe to build This pull request is marked safe to build from a trusted zone label Mar 8, 2024
@viambot
Copy link
Member

viambot commented Mar 8, 2024

Overall readability score: 55.57 (🟢 +0)

File Readability
_index.md 51.88 (🟢 +0)
View detailed metrics

🟢 - Shows an increase in readability
🔴 - Shows a decrease in readability

File Readability FRE GF ARI CLI DCRS
_index.md 51.88 37.44 11.65 16.3 12.48 6.14
  🟢 +0 🟢 +0 🟢 +0 🟢 +0 🟢 +0 🟢 +0

Averages:

  Readability FRE GF ARI CLI DCRS
Average 55.57 47.43 10.64 13.22 12.09 7.61
  🟢 +0 🟢 +0 🟢 +0 🟢 +0 🟢 +0 🟢 +0
View metric targets
Metric Range Ideal score
Flesch Reading Ease 100 (very easy read) to 0 (extremely difficult read) 60
Gunning Fog 6 (very easy read) to 17 (extremely difficult read) 8 or less
Auto. Read. Index 6 (very easy read) to 14 (extremely difficult read) 8 or less
Coleman Liau Index 6 (very easy read) to 17 (extremely difficult read) 8 or less
Dale-Chall Readability 4.9 (very easy read) to 9.9 (extremely difficult read) 6.9 or less

@andf-viam andf-viam requested a review from benjirewis March 8, 2024 19:13
Copy link
Member

@benjirewis benjirewis left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice! Just some nits on CInfo vs CInfof vs CInfow.

docs/registry/create/_index.md Outdated Show resolved Hide resolved
docs/registry/create/_index.md Outdated Show resolved Hide resolved
docs/registry/create/_index.md Outdated Show resolved Hide resolved
docs/registry/create/_index.md Outdated Show resolved Hide resolved
docs/registry/create/_index.md Outdated Show resolved Hide resolved
docs/registry/create/_index.md Outdated Show resolved Hide resolved
@andf-viam andf-viam requested a review from benjirewis March 8, 2024 19:28
@viambot
Copy link
Member

viambot commented Mar 8, 2024

You can view a rendered version of the docs from this PR at https://docs-test.viam.dev/2632

@@ -437,7 +437,7 @@ func (b *myBase) Reconfigure(ctx context.Context, deps resource.Dependencies, co

geometries, err := kinematicbase.CollisionGeometry(conf.Frame)
if err != nil {
b.logger.Warnf("base %v %s", b.Name(), err.Error())
b.logger.CWarnf(ctx, "base %v %s", b.Name(), err.Error())
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is there a reason why these methods are named with a C at the beginning? It feels rather unintuitive

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It was a decision the NetCode team made a while ago. Most loggers have methods that look like Debug, Debugf, and Debugw for all log levels. Most loggers also do not take a context.Context. We wanted to take a context on our logging methods to pass some "extra" information along with each log that could help with debugging the path a single operation was taking through the RDK. When an alternative version of a method that is otherwise identical to the original but offers a context.Context param is written in Golang, it's common practice to name that method either FooCtx of CFoo. We went with the latter.

@andf-viam andf-viam merged commit c331569 into viamrobotics:main Mar 12, 2024
10 checks passed
@andf-viam andf-viam deleted the DOCS-1827-go-logging-grpc branch March 12, 2024 20:47
sguequierre pushed a commit to sguequierre/docs that referenced this pull request Apr 25, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
safe to build This pull request is marked safe to build from a trusted zone
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants