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

refactor: add logger package #14872

Merged
merged 9 commits into from
Feb 1, 2023
Merged

refactor: add logger package #14872

merged 9 commits into from
Feb 1, 2023

Conversation

tac0turtle
Copy link
Member

Description

moves logger to its own package and adds a NoOp logger


Author Checklist

All items are required. Please add a note to the item if the item is not applicable and
please add links to any relevant follow up issues.

I have...

  • included the correct type prefix in the PR title
  • added ! to the type prefix if API or client breaking change
  • targeted the correct branch (see PR Targeting)
  • provided a link to the relevant issue or specification
  • followed the guidelines for building modules
  • included the necessary unit and integration tests
  • added a changelog entry to CHANGELOG.md
  • included comments for documenting Go code
  • updated the relevant documentation or specification
  • reviewed "Files changed" and left comments if necessary
  • confirmed all CI checks have passed

Reviewers Checklist

All items are required. Please add a note if the item is not applicable and please add
your handle next to the items reviewed if you only reviewed selected items.

I have...

  • confirmed the correct type prefix in the PR title
  • confirmed ! in the type prefix if API or client breaking change
  • confirmed all author checklist items have been addressed
  • reviewed state machine logic
  • reviewed API design and naming
  • reviewed documentation is accurate
  • reviewed tests and test coverage
  • manually tested (if applicable)

@tac0turtle tac0turtle requested a review from a team as a code owner February 1, 2023 19:37
@@ -0,0 +1,3 @@
module github.com/cosmos/cosmos-sdk/log
Copy link
Member

@julienrbrt julienrbrt Feb 1, 2023

Choose a reason for hiding this comment

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

Given that it is a small PR, could you add all the tooling too?

Copy link
Member Author

Choose a reason for hiding this comment

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

will do

Copy link
Member Author

Choose a reason for hiding this comment

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

I think I got it all

Copy link
Member

@julienrbrt julienrbrt Feb 1, 2023

Choose a reason for hiding this comment

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

Just one typo, and could you add it to dependabot?

Copy link
Member

Choose a reason for hiding this comment

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

Should we make it cosmossdk.io/log? Why not just have this interface in core? I think there should be a core logging service

Copy link
Member

@julienrbrt julienrbrt Feb 7, 2023

Choose a reason for hiding this comment

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

I thought core should not be containing any implementation.
If you had an interface in core and the implementation in logger that's a bit weird. Imo better to keep close the interface from its implementation for small packages like that.

Agrees that a vanity url is better however.

Copy link
Member

Choose a reason for hiding this comment

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

I think a no-op implementation in core is fine. That's all this has right? I don't have a strong preference on whether it goes in core, but I do think modules will want a logging service so that should probably go in core right?

Copy link
Member

Choose a reason for hiding this comment

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

Right, but maybe in that log package we can add a function for these logger too, so we don't duplicate other loggers:

Copy link
Member

@aaronc aaronc Feb 7, 2023

Choose a reason for hiding this comment

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

No, that probably shouldn't be in core. So if we can have a simple interface with zero dependencies, the same interface can exist in core and log. Log can provide some implementations like zerolog and comet. And core can have the same interface for the service but no implementations. The main thing I think is getting rid of the dependency on comet as I mentioned here #14904 (comment)

log/noop_logger.go Outdated Show resolved Hide resolved
Copy link
Member

@julienrbrt julienrbrt left a comment

Choose a reason for hiding this comment

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

pre-ACK.

@@ -0,0 +1,14 @@
sonar.projectKey=cosmos-sdk-log
Copy link
Member

Choose a reason for hiding this comment

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

@sonarcloud
Copy link

sonarcloud bot commented Feb 1, 2023

[Cosmos SDK - Log] Kudos, SonarCloud Quality Gate passed!    Quality Gate passed

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 0 Code Smells

No Coverage information No Coverage information
No Duplication information No Duplication information

log/logger.go Outdated Show resolved Hide resolved
Co-authored-by: Julien Robert <julien@rbrt.fr>
@tac0turtle tac0turtle enabled auto-merge (squash) February 1, 2023 23:20
@tac0turtle tac0turtle merged commit 6b256ce into main Feb 1, 2023
@tac0turtle tac0turtle deleted the marko/logger_pacakge branch February 1, 2023 23:42
samricotta pushed a commit that referenced this pull request Feb 7, 2023
Co-authored-by: Julien Robert <julien@rbrt.fr>
tsenart pushed a commit to meka-dev/cosmos-sdk that referenced this pull request Apr 12, 2023
Co-authored-by: Julien Robert <julien@rbrt.fr>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants